diff --git a/clippy.toml b/clippy.toml new file mode 100644 index 0000000000000..2ebc97cf45585 --- /dev/null +++ b/clippy.toml @@ -0,0 +1 @@ +doc-valid-idents = ["sRGB", "NaN", "iOS", "glTF", "GitHub", "WebGPU"] diff --git a/crates/bevy_app/src/plugin.rs b/crates/bevy_app/src/plugin.rs index 4f00625fb55a2..c6876db0b3b60 100644 --- a/crates/bevy_app/src/plugin.rs +++ b/crates/bevy_app/src/plugin.rs @@ -15,5 +15,6 @@ pub trait Plugin: Any + Send + Sync { } /// Type representing an unsafe function that returns a mutable pointer to a [`Plugin`]. -/// Used for dynamically loading plugins. See bevy_dynamic_plugin/src/loader.rs#dynamically_load_plugin +/// Used for dynamically loading plugins. See +/// `bevy_dynamic_plugin/src/loader.rs#dynamically_load_plugin` pub type CreatePlugin = unsafe fn() -> *mut dyn Plugin; diff --git a/crates/bevy_asset/src/assets.rs b/crates/bevy_asset/src/assets.rs index 8d248ff91140b..ade30b169dcd6 100644 --- a/crates/bevy_asset/src/assets.rs +++ b/crates/bevy_asset/src/assets.rs @@ -47,17 +47,17 @@ impl Debug for AssetEvent { /// Stores Assets of a given type and tracks changes to them. /// -/// Each asset is mapped by a unique [HandleId](crate::HandleId), allowing any [Handle](crate::Handle) -/// with the same HandleId to access it. These assets remain loaded for as long as a Strong handle -/// to that asset exists. +/// Each asset is mapped by a unique [`HandleId`], allowing any [`Handle`] with the same +/// [`HandleId`] to access it. These assets remain loaded for as long as a Strong handle to that +/// asset exists. /// /// To store a reference to an asset without forcing it to stay loaded, you can use a Weak handle. -/// To make a Weak handle a Strong one, use [Assets::get_handle](crate::Assets::get_handle) or pass -/// the Assets collection into the handle's [make_strong](crate::Handle::make_strong) method. -/// -/// Remember, if there are no Strong handles for an asset (i.e. they have all been dropped), the asset -/// will unload. Make sure you always have a Strong handle when you want to keep an asset loaded! +/// To make a Weak handle a Strong one, use [`Assets::get_handle`] or pass the `Assets` collection +/// into the handle's [`make_strong`](Handle::make_strong) method. /// +/// Remember, if there are no Strong handles for an asset (i.e. they have all been dropped), the +/// asset will unload. Make sure you always have a Strong handle when you want to keep an asset +/// loaded! #[derive(Debug)] pub struct Assets { assets: HashMap, @@ -92,7 +92,7 @@ impl Assets { /// Unless there exists another Strong handle for this asset, it's advised to use the returned /// Strong handle. Not doing so may result in the unexpected release of the asset. /// - /// See [set_untracked](Assets::set_untracked) for more info. + /// See [`set_untracked`](Assets::set_untracked) for more info. #[must_use = "not using the returned strong handle may result in the unexpected release of the asset"] pub fn set>(&mut self, handle: H, asset: T) -> Handle { let id: HandleId = handle.into(); @@ -102,8 +102,8 @@ impl Assets { /// Add/modify the asset pointed to by the given handle. /// - /// If an asset already exists with the given HandleId, it will be modified. Otherwise the new asset - /// will be inserted. + /// If an asset already exists with the given [`HandleId`], it will be modified. Otherwise the + /// new asset will be inserted. /// /// # Events /// * [`AssetEvent::Created`]: Sent if the asset did not yet exist with the given handle @@ -124,7 +124,7 @@ impl Assets { /// Get the asset for the given handle. /// /// This is the main method for accessing asset data from an [Assets] collection. If you need - /// mutable access to the asset, use [get_mut](Assets::get_mut). + /// mutable access to the asset, use [`get_mut`](Assets::get_mut). pub fn get>(&self, handle: H) -> Option<&T> { self.assets.get(&handle.into()) } @@ -190,7 +190,7 @@ impl Assets { self.assets.iter_mut().map(|(k, v)| (*k, v)) } - /// Get an iterator over all HandleIds in the collection. + /// Get an iterator over all [`HandleId`]'s in the collection. pub fn ids(&self) -> impl Iterator + '_ { self.assets.keys().cloned() } diff --git a/crates/bevy_crevice/src/lib.rs b/crates/bevy_crevice/src/lib.rs index 782e85cf4d938..48451966be4a5 100644 --- a/crates/bevy_crevice/src/lib.rs +++ b/crates/bevy_crevice/src/lib.rs @@ -3,7 +3,8 @@ clippy::needless_update, clippy::len_without_is_empty, clippy::needless_range_loop, - clippy::all + clippy::all, + clippy::doc_markdown )] /*! [![GitHub CI Status](https://github.com/LPGhatguy/crevice/workflows/CI/badge.svg)](https://github.com/LPGhatguy/crevice/actions) diff --git a/crates/bevy_internal/src/lib.rs b/crates/bevy_internal/src/lib.rs index dd7d9d58cd11c..7435fde7b0b4a 100644 --- a/crates/bevy_internal/src/lib.rs +++ b/crates/bevy_internal/src/lib.rs @@ -94,7 +94,7 @@ pub mod core_pipeline { #[cfg(feature = "bevy_gilrs")] pub mod gilrs { - //! Bevy interface with GilRs - Game Input Library for Rust to handle gamepad inputs + //! Bevy interface with `GilRs` - "Game Input Library for Rust" - to handle gamepad inputs. pub use bevy_gilrs::*; } diff --git a/crates/bevy_render/src/options.rs b/crates/bevy_render/src/options.rs index 2211cf9530a3e..39ef493b9eb8c 100644 --- a/crates/bevy_render/src/options.rs +++ b/crates/bevy_render/src/options.rs @@ -55,7 +55,7 @@ impl Default for WgpuOptions { } } -/// Get a features/limits priority from the environment variable WGPU_OPTIONS_PRIO +/// Get a features/limits priority from the environment variable `WGPU_OPTIONS_PRIO` pub fn options_priority_from_env() -> Option { Some( match std::env::var("WGPU_OPTIONS_PRIO") diff --git a/crates/bevy_transform/src/components/global_transform.rs b/crates/bevy_transform/src/components/global_transform.rs index 13bdf35474318..141308def70a2 100644 --- a/crates/bevy_transform/src/components/global_transform.rs +++ b/crates/bevy_transform/src/components/global_transform.rs @@ -175,7 +175,7 @@ impl GlobalTransform { self.rotation * Vec3::Z } - /// Equivalent to [`-local_z()`][[GlobalTransform::local_z] + /// Equivalent to [`-local_z()`][GlobalTransform::local_z] #[inline] pub fn forward(&self) -> Vec3 { -self.local_z() diff --git a/crates/bevy_window/src/window.rs b/crates/bevy_window/src/window.rs index db202c27173f5..7381a32134ef7 100644 --- a/crates/bevy_window/src/window.rs +++ b/crates/bevy_window/src/window.rs @@ -256,7 +256,7 @@ impl Window { } /// The requested window client area width in logical pixels from window - /// creation or the last call to [set_resolution](Window::set_resolution). + /// creation or the last call to [`set_resolution`](Window::set_resolution). /// /// This may differ from the actual width depending on OS size limits and /// the scaling factor for high DPI monitors. @@ -266,7 +266,7 @@ impl Window { } /// The requested window client area height in logical pixels from window - /// creation or the last call to [set_resolution](Window::set_resolution). + /// creation or the last call to [`set_resolution`](Window::set_resolution). /// /// This may differ from the actual width depending on OS size limits and /// the scaling factor for high DPI monitors. @@ -403,7 +403,7 @@ impl Window { } /// The window scale factor as reported by the window backend. - /// This value is unaffected by scale_factor_override. + /// This value is unaffected by [`scale_factor_override`](Window::scale_factor_override). #[inline] pub fn backend_scale_factor(&self) -> f64 { self.backend_scale_factor diff --git a/tools/ci/src/main.rs b/tools/ci/src/main.rs index 76bc476c11c60..336db74da7db3 100644 --- a/tools/ci/src/main.rs +++ b/tools/ci/src/main.rs @@ -13,7 +13,7 @@ fn main() { // See if clippy has any complaints. // - Type complexity must be ignored because we use huge templates for queries - cmd!("cargo clippy --workspace --all-targets --all-features -- -D warnings -A clippy::type_complexity") + cmd!("cargo clippy --workspace --all-targets --all-features -- -D warnings -A clippy::type_complexity -W clippy::doc_markdown") .run() .expect("Please fix clippy errors in output above.");