Skip to content

Commit 417e6cc

Browse files
authored
Fix doc link import style to avoid unused_imports (#15337)
# Objective - Fixes: #15323
1 parent 48f2bd4 commit 417e6cc

File tree

3 files changed

+26
-36
lines changed

3 files changed

+26
-36
lines changed

crates/bevy_asset/src/io/source.rs

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@ use thiserror::Error;
1111

1212
use super::{ErasedAssetReader, ErasedAssetWriter};
1313

14-
#[allow(unused_imports, reason = "Needed for documentation links.")]
15-
use crate::io::{AssetReader, AssetWriter};
16-
17-
/// A reference to an "asset source", which maps to an [`AssetReader`] and/or [`AssetWriter`].
14+
/// A reference to an "asset source", which maps to an [`AssetReader`](crate::io::AssetReader) and/or [`AssetWriter`](crate::io::AssetWriter).
1815
///
1916
/// * [`AssetSourceId::Default`] corresponds to "default asset paths" that don't specify a source: `/path/to/asset.png`
2017
/// * [`AssetSourceId::Name`] corresponds to asset paths that _do_ specify a source: `remote://path/to/asset.png`, where `remote` is the name.
@@ -126,7 +123,7 @@ impl<'a> PartialEq for AssetSourceId<'a> {
126123
}
127124
}
128125

129-
/// Metadata about an "asset source", such as how to construct the [`AssetReader`] and [`AssetWriter`] for the source,
126+
/// Metadata about an "asset source", such as how to construct the [`AssetReader`](crate::io::AssetReader) and [`AssetWriter`](crate::io::AssetWriter) for the source,
130127
/// and whether or not the source is processed.
131128
#[derive(Default)]
132129
pub struct AssetSourceBuilder {
@@ -209,7 +206,7 @@ impl AssetSourceBuilder {
209206
Some(source)
210207
}
211208

212-
/// Will use the given `reader` function to construct unprocessed [`AssetReader`] instances.
209+
/// Will use the given `reader` function to construct unprocessed [`AssetReader`](crate::io::AssetReader) instances.
213210
pub fn with_reader(
214211
mut self,
215212
reader: impl FnMut() -> Box<dyn ErasedAssetReader> + Send + Sync + 'static,
@@ -218,7 +215,7 @@ impl AssetSourceBuilder {
218215
self
219216
}
220217

221-
/// Will use the given `writer` function to construct unprocessed [`AssetWriter`] instances.
218+
/// Will use the given `writer` function to construct unprocessed [`AssetWriter`](crate::io::AssetWriter) instances.
222219
pub fn with_writer(
223220
mut self,
224221
writer: impl FnMut(bool) -> Option<Box<dyn ErasedAssetWriter>> + Send + Sync + 'static,
@@ -239,7 +236,7 @@ impl AssetSourceBuilder {
239236
self
240237
}
241238

242-
/// Will use the given `reader` function to construct processed [`AssetReader`] instances.
239+
/// Will use the given `reader` function to construct processed [`AssetReader`](crate::io::AssetReader) instances.
243240
pub fn with_processed_reader(
244241
mut self,
245242
reader: impl FnMut() -> Box<dyn ErasedAssetReader> + Send + Sync + 'static,
@@ -248,7 +245,7 @@ impl AssetSourceBuilder {
248245
self
249246
}
250247

251-
/// Will use the given `writer` function to construct processed [`AssetWriter`] instances.
248+
/// Will use the given `writer` function to construct processed [`AssetWriter`](crate::io::AssetWriter) instances.
252249
pub fn with_processed_writer(
253250
mut self,
254251
writer: impl FnMut(bool) -> Option<Box<dyn ErasedAssetWriter>> + Send + Sync + 'static,
@@ -308,7 +305,7 @@ impl AssetSourceBuilder {
308305
}
309306
}
310307

311-
/// A [`Resource`] that hold (repeatable) functions capable of producing new [`AssetReader`] and [`AssetWriter`] instances
308+
/// A [`Resource`] that hold (repeatable) functions capable of producing new [`AssetReader`](crate::io::AssetReader) and [`AssetWriter`](crate::io::AssetWriter) instances
312309
/// for a given asset source.
313310
#[derive(Resource, Default)]
314311
pub struct AssetSourceBuilders {
@@ -371,7 +368,7 @@ impl AssetSourceBuilders {
371368
}
372369
}
373370

374-
/// A collection of unprocessed and processed [`AssetReader`], [`AssetWriter`], and [`AssetWatcher`] instances
371+
/// A collection of unprocessed and processed [`AssetReader`](crate::io::AssetReader), [`AssetWriter`](crate::io::AssetWriter), and [`AssetWatcher`] instances
375372
/// for a specific asset source, identified by an [`AssetSourceId`].
376373
pub struct AssetSource {
377374
id: AssetSourceId<'static>,
@@ -397,21 +394,21 @@ impl AssetSource {
397394
self.id.clone()
398395
}
399396

400-
/// Return's this source's unprocessed [`AssetReader`].
397+
/// Return's this source's unprocessed [`AssetReader`](crate::io::AssetReader).
401398
#[inline]
402399
pub fn reader(&self) -> &dyn ErasedAssetReader {
403400
&*self.reader
404401
}
405402

406-
/// Return's this source's unprocessed [`AssetWriter`], if it exists.
403+
/// Return's this source's unprocessed [`AssetWriter`](crate::io::AssetWriter), if it exists.
407404
#[inline]
408405
pub fn writer(&self) -> Result<&dyn ErasedAssetWriter, MissingAssetWriterError> {
409406
self.writer
410407
.as_deref()
411408
.ok_or_else(|| MissingAssetWriterError(self.id.clone_owned()))
412409
}
413410

414-
/// Return's this source's processed [`AssetReader`], if it exists.
411+
/// Return's this source's processed [`AssetReader`](crate::io::AssetReader), if it exists.
415412
#[inline]
416413
pub fn processed_reader(
417414
&self,
@@ -421,7 +418,7 @@ impl AssetSource {
421418
.ok_or_else(|| MissingProcessedAssetReaderError(self.id.clone_owned()))
422419
}
423420

424-
/// Return's this source's processed [`AssetWriter`], if it exists.
421+
/// Return's this source's processed [`AssetWriter`](crate::io::AssetWriter), if it exists.
425422
#[inline]
426423
pub fn processed_writer(
427424
&self,
@@ -451,7 +448,7 @@ impl AssetSource {
451448
self.processed_writer.is_some()
452449
}
453450

454-
/// Returns a builder function for this platform's default [`AssetReader`]. `path` is the relative path to
451+
/// Returns a builder function for this platform's default [`AssetReader`](crate::io::AssetReader). `path` is the relative path to
455452
/// the asset root.
456453
pub fn get_default_reader(
457454
_path: String,
@@ -466,7 +463,7 @@ impl AssetSource {
466463
}
467464
}
468465

469-
/// Returns a builder function for this platform's default [`AssetWriter`]. `path` is the relative path to
466+
/// Returns a builder function for this platform's default [`AssetWriter`](crate::io::AssetWriter). `path` is the relative path to
470467
/// the asset root. This will return [`None`] if this platform does not support writing assets by default.
471468
pub fn get_default_writer(
472469
_path: String,
@@ -557,7 +554,7 @@ impl AssetSource {
557554
}
558555
}
559556

560-
/// This will cause processed [`AssetReader`] futures (such as [`AssetReader::read`]) to wait until
557+
/// This will cause processed [`AssetReader`](crate::io::AssetReader) futures (such as [`AssetReader::read`](crate::io::AssetReader::read)) to wait until
561558
/// the [`AssetProcessor`](crate::AssetProcessor) has finished processing the requested asset.
562559
pub fn gate_on_processor(&mut self, processor_data: Arc<AssetProcessorData>) {
563560
if let Some(reader) = self.processed_reader.take() {
@@ -619,7 +616,7 @@ impl AssetSources {
619616
.chain(Some(AssetSourceId::Default))
620617
}
621618

622-
/// This will cause processed [`AssetReader`] futures (such as [`AssetReader::read`]) to wait until
619+
/// This will cause processed [`AssetReader`](crate::io::AssetReader) futures (such as [`AssetReader::read`](crate::io::AssetReader::read)) to wait until
623620
/// the [`AssetProcessor`](crate::AssetProcessor) has finished processing the requested asset.
624621
pub fn gate_on_processor(&mut self, processor_data: Arc<AssetProcessorData>) {
625622
for source in self.iter_processed_mut() {
@@ -633,17 +630,17 @@ impl AssetSources {
633630
#[error("Asset Source '{0}' does not exist")]
634631
pub struct MissingAssetSourceError(AssetSourceId<'static>);
635632

636-
/// An error returned when an [`AssetWriter`] does not exist for a given id.
633+
/// An error returned when an [`AssetWriter`](crate::io::AssetWriter) does not exist for a given id.
637634
#[derive(Error, Debug, Clone)]
638635
#[error("Asset Source '{0}' does not have an AssetWriter.")]
639636
pub struct MissingAssetWriterError(AssetSourceId<'static>);
640637

641-
/// An error returned when a processed [`AssetReader`] does not exist for a given id.
638+
/// An error returned when a processed [`AssetReader`](crate::io::AssetReader) does not exist for a given id.
642639
#[derive(Error, Debug, Clone, PartialEq, Eq)]
643640
#[error("Asset Source '{0}' does not have a processed AssetReader.")]
644641
pub struct MissingProcessedAssetReaderError(AssetSourceId<'static>);
645642

646-
/// An error returned when a processed [`AssetWriter`] does not exist for a given id.
643+
/// An error returned when a processed [`AssetWriter`](crate::io::AssetWriter) does not exist for a given id.
647644
#[derive(Error, Debug, Clone)]
648645
#[error("Asset Source '{0}' does not have a processed AssetWriter.")]
649646
pub struct MissingProcessedAssetWriterError(AssetSourceId<'static>);

crates/bevy_asset/src/processor/mod.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,7 @@ use std::{
7575
};
7676
use thiserror::Error;
7777

78-
// Needed for doc strings
79-
#[allow(unused_imports, reason = "Needed for documentation links.")]
80-
use crate::io::{AssetReader, AssetWriter};
81-
82-
/// A "background" asset processor that reads asset values from a source [`AssetSource`] (which corresponds to an [`AssetReader`] / [`AssetWriter`] pair),
78+
/// A "background" asset processor that reads asset values from a source [`AssetSource`] (which corresponds to an [`AssetReader`](crate::io::AssetReader) / [`AssetWriter`](crate::io::AssetWriter) pair),
8379
/// processes them in some way, and writes them to a destination [`AssetSource`].
8480
///
8581
/// This will create .meta files (a human-editable serialized form of [`AssetMeta`]) in the source [`AssetSource`] for assets that
@@ -212,9 +208,9 @@ impl AssetProcessor {
212208
/// Processes all assets. This will:
213209
/// * For each "processed [`AssetSource`]:
214210
/// * Scan the [`ProcessorTransactionLog`] and recover from any failures detected
215-
/// * Scan the processed [`AssetReader`] to build the current view of already processed assets.
216-
/// * Scan the unprocessed [`AssetReader`] and remove any final processed assets that are invalid or no longer exist.
217-
/// * For each asset in the unprocessed [`AssetReader`], kick off a new "process job", which will process the asset
211+
/// * Scan the processed [`AssetReader`](crate::io::AssetReader) to build the current view of already processed assets.
212+
/// * Scan the unprocessed [`AssetReader`](crate::io::AssetReader) and remove any final processed assets that are invalid or no longer exist.
213+
/// * For each asset in the unprocessed [`AssetReader`](crate::io::AssetReader), kick off a new "process job", which will process the asset
218214
/// (if the latest version of the asset has not been processed).
219215
#[cfg(all(not(target_arch = "wasm32"), feature = "multi_threaded"))]
220216
pub fn process_assets(&self) {

crates/bevy_asset/src/server/mod.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,7 @@ use std::{any::TypeId, path::Path, sync::Arc};
3232
use std::{future::Future, panic::AssertUnwindSafe};
3333
use thiserror::Error;
3434

35-
#[allow(unused_imports, reason = "Needed for documentation links.")]
36-
use crate::io::{AssetReader, AssetWriter};
37-
38-
/// Loads and tracks the state of [`Asset`] values from a configured [`AssetReader`]. This can be used to kick off new asset loads and
35+
/// Loads and tracks the state of [`Asset`] values from a configured [`AssetReader`](crate::io::AssetReader). This can be used to kick off new asset loads and
3936
/// retrieve their current load states.
4037
///
4138
/// The general process to load an asset is:
@@ -75,7 +72,7 @@ pub enum AssetServerMode {
7572
}
7673

7774
impl AssetServer {
78-
/// Create a new instance of [`AssetServer`]. If `watch_for_changes` is true, the [`AssetReader`] storage will watch for changes to
75+
/// Create a new instance of [`AssetServer`]. If `watch_for_changes` is true, the [`AssetReader`](crate::io::AssetReader) storage will watch for changes to
7976
/// asset sources and hot-reload them.
8077
pub fn new(sources: AssetSources, mode: AssetServerMode, watching_for_changes: bool) -> Self {
8178
Self::new_with_loaders(
@@ -87,7 +84,7 @@ impl AssetServer {
8784
)
8885
}
8986

90-
/// Create a new instance of [`AssetServer`]. If `watch_for_changes` is true, the [`AssetReader`] storage will watch for changes to
87+
/// Create a new instance of [`AssetServer`]. If `watch_for_changes` is true, the [`AssetReader`](crate::io::AssetReader) storage will watch for changes to
9188
/// asset sources and hot-reload them.
9289
pub fn new_with_meta_check(
9390
sources: AssetSources,

0 commit comments

Comments
 (0)