From 7d76028ec651d38f31e726aab00856aa6759ff7b Mon Sep 17 00:00:00 2001 From: tygyh Date: Sun, 26 Nov 2023 14:42:56 +0100 Subject: [PATCH 1/4] Remove unnecessary path prefixes --- crates/bevy_app/src/app.rs | 16 +++--- crates/bevy_asset/macros/src/lib.rs | 2 +- crates/bevy_asset/src/io/embedded/mod.rs | 4 +- crates/bevy_asset/src/io/file/file_asset.rs | 22 +++----- crates/bevy_asset/src/io/file/file_watcher.rs | 2 +- crates/bevy_asset/src/io/gated.rs | 2 +- crates/bevy_asset/src/io/memory.rs | 6 +-- crates/bevy_asset/src/io/mod.rs | 4 +- crates/bevy_asset/src/io/processor_gated.rs | 4 +- crates/bevy_asset/src/lib.rs | 16 +++--- crates/bevy_asset/src/path.rs | 18 +++---- crates/bevy_asset/src/processor/mod.rs | 2 +- crates/bevy_audio/src/audio_output.rs | 2 +- crates/bevy_core/src/name.rs | 2 +- .../bevy_core_pipeline/src/tonemapping/mod.rs | 22 ++++---- .../src/frame_time_diagnostics_plugin.rs | 2 +- crates/bevy_ecs/macros/src/world_query.rs | 6 +-- .../bevy_ecs/macros/src/world_query_data.rs | 6 +-- crates/bevy_ecs/src/archetype.rs | 2 +- crates/bevy_ecs/src/component.rs | 6 +-- crates/bevy_ecs/src/entity/map_entities.rs | 2 +- crates/bevy_ecs/src/entity/mod.rs | 4 +- crates/bevy_ecs/src/event.rs | 2 +- crates/bevy_ecs/src/query/fetch.rs | 6 +-- crates/bevy_ecs/src/query/filter.rs | 4 -- crates/bevy_ecs/src/query/state.rs | 2 +- crates/bevy_ecs/src/query/world_query.rs | 6 +-- crates/bevy_ecs/src/reflect/bundle.rs | 4 +- crates/bevy_ecs/src/reflect/component.rs | 2 +- crates/bevy_ecs/src/removal_detection.rs | 4 +- crates/bevy_ecs/src/schedule/condition.rs | 2 +- .../src/schedule/executor/multi_threaded.rs | 2 +- crates/bevy_ecs/src/schedule/graph_utils.rs | 6 +-- crates/bevy_ecs/src/schedule/schedule.rs | 30 +++++------ crates/bevy_ecs/src/schedule/set.rs | 4 +- crates/bevy_ecs/src/storage/blob_vec.rs | 2 +- crates/bevy_ecs/src/storage/table.rs | 14 ++--- crates/bevy_ecs/src/system/commands/mod.rs | 6 +-- crates/bevy_ecs/src/system/function_system.rs | 4 +- crates/bevy_ecs/src/system/mod.rs | 8 +-- crates/bevy_ecs/src/system/query.rs | 6 +-- crates/bevy_ecs/src/system/system.rs | 6 +-- crates/bevy_ecs/src/system/system_param.rs | 6 +-- crates/bevy_ecs/src/system/system_registry.rs | 2 +- crates/bevy_ecs/src/world/identifier.rs | 2 +- crates/bevy_ecs/src/world/mod.rs | 10 ++-- .../bevy_ecs/src/world/unsafe_world_cell.rs | 2 +- crates/bevy_gilrs/src/rumble.rs | 2 +- crates/bevy_gltf/src/loader.rs | 30 +++++------ crates/bevy_input/src/keyboard.rs | 2 +- crates/bevy_input/src/mouse.rs | 2 +- crates/bevy_internal/src/lib.rs | 6 +-- crates/bevy_macro_utils/src/fq_std.rs | 16 +++--- crates/bevy_macro_utils/src/shape.rs | 2 +- crates/bevy_pbr/src/extended_material.rs | 15 +++--- crates/bevy_pbr/src/lib.rs | 9 ++-- crates/bevy_pbr/src/light.rs | 10 ++-- crates/bevy_pbr/src/material.rs | 2 +- crates/bevy_pbr/src/pbr_material.rs | 6 +-- crates/bevy_pbr/src/prepass/mod.rs | 6 +-- crates/bevy_pbr/src/render/mesh.rs | 4 +- .../src/container_attributes.rs | 2 +- .../bevy_reflect_derive/src/derive_data.rs | 8 +-- .../bevy_reflect_derive/src/impls/structs.rs | 2 +- .../src/impls/tuple_structs.rs | 2 +- crates/bevy_reflect/src/array.rs | 2 +- crates/bevy_reflect/src/enums/enum_trait.rs | 4 +- crates/bevy_reflect/src/impls/std.rs | 6 +-- crates/bevy_reflect/src/lib.rs | 13 ++--- crates/bevy_reflect/src/list.rs | 6 +-- crates/bevy_reflect/src/map.rs | 4 +- crates/bevy_reflect/src/serde/de.rs | 53 +++++++++---------- crates/bevy_reflect/src/serde/ser.rs | 4 +- crates/bevy_reflect/src/struct_trait.rs | 2 +- crates/bevy_reflect/src/tuple.rs | 2 +- crates/bevy_reflect/src/tuple_struct.rs | 2 +- crates/bevy_reflect/src/type_info.rs | 4 +- crates/bevy_reflect/src/type_registry.rs | 8 +-- crates/bevy_render/src/camera/camera.rs | 4 +- crates/bevy_render/src/lib.rs | 12 ++--- crates/bevy_render/src/mesh/mesh/mod.rs | 6 +-- crates/bevy_render/src/pipelined_rendering.rs | 2 +- .../render_resource/batched_uniform_buffer.rs | 2 +- .../src/render_resource/bind_group.rs | 2 +- .../bind_group_layout_entries.rs | 16 +++--- .../src/render_resource/buffer_vec.rs | 8 +-- .../src/render_resource/storage_buffer.rs | 8 +-- .../src/render_resource/uniform_buffer.rs | 6 +-- crates/bevy_render/src/renderer/mod.rs | 2 +- crates/bevy_render/src/settings.rs | 4 +- .../src/texture/compressed_image_saver.rs | 2 +- crates/bevy_render/src/texture/image.rs | 8 +-- .../bevy_render/src/texture/image_loader.rs | 2 +- .../bevy_render/src/texture/texture_cache.rs | 2 +- crates/bevy_render/src/view/visibility/mod.rs | 4 +- .../src/view/visibility/render_layers.rs | 4 +- crates/bevy_render/src/view/window/mod.rs | 2 +- .../bevy_render/src/view/window/screenshot.rs | 6 +-- crates/bevy_scene/src/serde.rs | 24 ++++----- crates/bevy_tasks/src/iter/mod.rs | 2 +- crates/bevy_tasks/src/task_pool.rs | 12 ++--- crates/bevy_tasks/src/thread_executor.rs | 2 +- crates/bevy_text/src/glyph_brush.rs | 2 +- crates/bevy_text/src/lib.rs | 2 +- .../src/components/transform.rs | 2 +- crates/bevy_transform/src/lib.rs | 2 +- crates/bevy_ui/src/layout/convert.rs | 24 ++++----- crates/bevy_ui/src/lib.rs | 2 +- .../src/render/ui_material_pipeline.rs | 2 +- crates/bevy_utils/src/default.rs | 2 +- crates/bevy_utils/src/futures.rs | 2 +- crates/bevy_utils/src/intern.rs | 4 +- crates/bevy_utils/src/label.rs | 4 +- crates/bevy_utils/src/lib.rs | 2 +- crates/bevy_utils/src/uuid.rs | 2 +- crates/bevy_window/src/window.rs | 8 +-- crates/bevy_winit/src/lib.rs | 12 ++--- crates/bevy_winit/src/winit_windows.rs | 16 +++--- examples/2d/mesh2d.rs | 2 +- examples/2d/mesh2d_vertex_color_texture.rs | 2 +- examples/ecs/one_shot_systems.rs | 4 +- examples/ecs/system_piping.rs | 2 +- tests/window/resizing.rs | 10 ++-- tools/example-showcase/src/main.rs | 2 +- 124 files changed, 370 insertions(+), 412 deletions(-) diff --git a/crates/bevy_app/src/app.rs b/crates/bevy_app/src/app.rs index 77303f7695272..a8608171145c0 100644 --- a/crates/bevy_app/src/app.rs +++ b/crates/bevy_app/src/app.rs @@ -889,7 +889,7 @@ impl App { self } - /// When doing [ambiguity checking](bevy_ecs::schedule::ScheduleBuildSettings) this + /// When doing [ambiguity checking](ScheduleBuildSettings) this /// ignores systems that are ambiguous on [`Component`] T. /// /// This settings only applies to the main world. To apply this to other worlds call the @@ -927,7 +927,7 @@ impl App { self } - /// When doing [ambiguity checking](bevy_ecs::schedule::ScheduleBuildSettings) this + /// When doing [ambiguity checking](ScheduleBuildSettings) this /// ignores systems that are ambiguous on [`Resource`] T. /// /// This settings only applies to the main world. To apply this to other worlds call the @@ -1004,19 +1004,19 @@ mod tests { struct PluginA; impl Plugin for PluginA { - fn build(&self, _app: &mut crate::App) {} + fn build(&self, _app: &mut App) {} } struct PluginB; impl Plugin for PluginB { - fn build(&self, _app: &mut crate::App) {} + fn build(&self, _app: &mut App) {} } struct PluginC(T); impl Plugin for PluginC { - fn build(&self, _app: &mut crate::App) {} + fn build(&self, _app: &mut App) {} } struct PluginD; impl Plugin for PluginD { - fn build(&self, _app: &mut crate::App) {} + fn build(&self, _app: &mut App) {} fn is_unique(&self) -> bool { false } @@ -1049,10 +1049,10 @@ mod tests { struct PluginRun; struct InnerPlugin; impl Plugin for InnerPlugin { - fn build(&self, _: &mut crate::App) {} + fn build(&self, _: &mut App) {} } impl Plugin for PluginRun { - fn build(&self, app: &mut crate::App) { + fn build(&self, app: &mut App) { app.add_plugins(InnerPlugin).run(); } } diff --git a/crates/bevy_asset/macros/src/lib.rs b/crates/bevy_asset/macros/src/lib.rs index 6d71b3d2991df..952cf8d7d7aec 100644 --- a/crates/bevy_asset/macros/src/lib.rs +++ b/crates/bevy_asset/macros/src/lib.rs @@ -3,7 +3,7 @@ use proc_macro::{Span, TokenStream}; use quote::{format_ident, quote}; use syn::{parse_macro_input, Data, DeriveInput, Path}; -pub(crate) fn bevy_asset_path() -> syn::Path { +pub(crate) fn bevy_asset_path() -> Path { BevyManifest::default().get_path("bevy_asset") } diff --git a/crates/bevy_asset/src/io/embedded/mod.rs b/crates/bevy_asset/src/io/embedded/mod.rs index f6620b3e69cec..a7f6b9f188316 100644 --- a/crates/bevy_asset/src/io/embedded/mod.rs +++ b/crates/bevy_asset/src/io/embedded/mod.rs @@ -22,9 +22,7 @@ pub const EMBEDDED: &str = "embedded"; pub struct EmbeddedAssetRegistry { dir: Dir, #[cfg(feature = "embedded_watcher")] - root_paths: std::sync::Arc< - parking_lot::RwLock>, - >, + root_paths: std::sync::Arc>>, } impl EmbeddedAssetRegistry { diff --git a/crates/bevy_asset/src/io/file/file_asset.rs b/crates/bevy_asset/src/io/file/file_asset.rs index b33a2c80bb0e7..7fd95cde358b4 100644 --- a/crates/bevy_asset/src/io/file/file_asset.rs +++ b/crates/bevy_asset/src/io/file/file_asset.rs @@ -95,7 +95,7 @@ impl AssetReader for FileAssetReader { fn is_directory<'a>( &'a self, path: &'a Path, - ) -> BoxedFuture<'a, std::result::Result> { + ) -> BoxedFuture<'a, Result> { Box::pin(async move { let full_path = self.root_path.join(path); let metadata = full_path @@ -138,10 +138,7 @@ impl AssetWriter for FileAssetWriter { }) } - fn remove<'a>( - &'a self, - path: &'a Path, - ) -> BoxedFuture<'a, std::result::Result<(), AssetWriterError>> { + fn remove<'a>(&'a self, path: &'a Path) -> BoxedFuture<'a, Result<(), AssetWriterError>> { Box::pin(async move { let full_path = self.root_path.join(path); async_fs::remove_file(full_path).await?; @@ -149,10 +146,7 @@ impl AssetWriter for FileAssetWriter { }) } - fn remove_meta<'a>( - &'a self, - path: &'a Path, - ) -> BoxedFuture<'a, std::result::Result<(), AssetWriterError>> { + fn remove_meta<'a>(&'a self, path: &'a Path) -> BoxedFuture<'a, Result<(), AssetWriterError>> { Box::pin(async move { let meta_path = get_meta_path(path); let full_path = self.root_path.join(meta_path); @@ -164,7 +158,7 @@ impl AssetWriter for FileAssetWriter { fn remove_directory<'a>( &'a self, path: &'a Path, - ) -> BoxedFuture<'a, std::result::Result<(), AssetWriterError>> { + ) -> BoxedFuture<'a, Result<(), AssetWriterError>> { Box::pin(async move { let full_path = self.root_path.join(path); async_fs::remove_dir_all(full_path).await?; @@ -175,7 +169,7 @@ impl AssetWriter for FileAssetWriter { fn remove_empty_directory<'a>( &'a self, path: &'a Path, - ) -> BoxedFuture<'a, std::result::Result<(), AssetWriterError>> { + ) -> BoxedFuture<'a, Result<(), AssetWriterError>> { Box::pin(async move { let full_path = self.root_path.join(path); async_fs::remove_dir(full_path).await?; @@ -186,7 +180,7 @@ impl AssetWriter for FileAssetWriter { fn remove_assets_in_directory<'a>( &'a self, path: &'a Path, - ) -> BoxedFuture<'a, std::result::Result<(), AssetWriterError>> { + ) -> BoxedFuture<'a, Result<(), AssetWriterError>> { Box::pin(async move { let full_path = self.root_path.join(path); async_fs::remove_dir_all(&full_path).await?; @@ -199,7 +193,7 @@ impl AssetWriter for FileAssetWriter { &'a self, old_path: &'a Path, new_path: &'a Path, - ) -> BoxedFuture<'a, std::result::Result<(), AssetWriterError>> { + ) -> BoxedFuture<'a, Result<(), AssetWriterError>> { Box::pin(async move { let full_old_path = self.root_path.join(old_path); let full_new_path = self.root_path.join(new_path); @@ -215,7 +209,7 @@ impl AssetWriter for FileAssetWriter { &'a self, old_path: &'a Path, new_path: &'a Path, - ) -> BoxedFuture<'a, std::result::Result<(), AssetWriterError>> { + ) -> BoxedFuture<'a, Result<(), AssetWriterError>> { Box::pin(async move { let old_meta_path = get_meta_path(old_path); let new_meta_path = get_meta_path(new_path); diff --git a/crates/bevy_asset/src/io/file/file_watcher.rs b/crates/bevy_asset/src/io/file/file_watcher.rs index d701b225beda7..e6418b04f0154 100644 --- a/crates/bevy_asset/src/io/file/file_watcher.rs +++ b/crates/bevy_asset/src/io/file/file_watcher.rs @@ -243,7 +243,7 @@ pub(crate) fn new_asset_event_debouncer( } pub(crate) struct FileEventHandler { - sender: crossbeam_channel::Sender, + sender: Sender, root: PathBuf, last_event: Option, } diff --git a/crates/bevy_asset/src/io/gated.rs b/crates/bevy_asset/src/io/gated.rs index 2c96399c0c0f7..8a049263dab70 100644 --- a/crates/bevy_asset/src/io/gated.rs +++ b/crates/bevy_asset/src/io/gated.rs @@ -93,7 +93,7 @@ impl AssetReader for GatedReader { fn is_directory<'a>( &'a self, path: &'a Path, - ) -> BoxedFuture<'a, std::result::Result> { + ) -> BoxedFuture<'a, Result> { self.reader.is_directory(path) } } diff --git a/crates/bevy_asset/src/io/memory.rs b/crates/bevy_asset/src/io/memory.rs index 3dca5042dbd52..94f31928a75f4 100644 --- a/crates/bevy_asset/src/io/memory.rs +++ b/crates/bevy_asset/src/io/memory.rs @@ -216,10 +216,10 @@ struct DataReader { impl AsyncRead for DataReader { fn poll_read( - mut self: std::pin::Pin<&mut Self>, + mut self: Pin<&mut Self>, cx: &mut std::task::Context<'_>, buf: &mut [u8], - ) -> std::task::Poll> { + ) -> Poll> { if self.bytes_read >= self.data.value().len() { Poll::Ready(Ok(0)) } else { @@ -286,7 +286,7 @@ impl AssetReader for MemoryAssetReader { fn is_directory<'a>( &'a self, path: &'a Path, - ) -> BoxedFuture<'a, std::result::Result> { + ) -> BoxedFuture<'a, Result> { Box::pin(async move { Ok(self.root.get_dir(path).is_some()) }) } } diff --git a/crates/bevy_asset/src/io/mod.rs b/crates/bevy_asset/src/io/mod.rs index a8e185d91caa6..742dd40b8b071 100644 --- a/crates/bevy_asset/src/io/mod.rs +++ b/crates/bevy_asset/src/io/mod.rs @@ -238,10 +238,10 @@ impl VecReader { impl AsyncRead for VecReader { fn poll_read( - mut self: std::pin::Pin<&mut Self>, + mut self: Pin<&mut Self>, cx: &mut std::task::Context<'_>, buf: &mut [u8], - ) -> std::task::Poll> { + ) -> Poll> { if self.bytes_read >= self.bytes.len() { Poll::Ready(Ok(0)) } else { diff --git a/crates/bevy_asset/src/io/processor_gated.rs b/crates/bevy_asset/src/io/processor_gated.rs index 1705900aeb9e1..ed5aacb0a911f 100644 --- a/crates/bevy_asset/src/io/processor_gated.rs +++ b/crates/bevy_asset/src/io/processor_gated.rs @@ -118,7 +118,7 @@ impl AssetReader for ProcessorGatedReader { fn is_directory<'a>( &'a self, path: &'a Path, - ) -> BoxedFuture<'a, std::result::Result> { + ) -> BoxedFuture<'a, Result> { Box::pin(async move { trace!( "Waiting for processing to finish before reading directory {:?}", @@ -149,7 +149,7 @@ impl<'a> TransactionLockedReader<'a> { impl<'a> AsyncRead for TransactionLockedReader<'a> { fn poll_read( - mut self: std::pin::Pin<&mut Self>, + mut self: Pin<&mut Self>, cx: &mut std::task::Context<'_>, buf: &mut [u8], ) -> std::task::Poll> { diff --git a/crates/bevy_asset/src/lib.rs b/crates/bevy_asset/src/lib.rs index d0e07e62af73a..61eeb58f8a453 100644 --- a/crates/bevy_asset/src/lib.rs +++ b/crates/bevy_asset/src/lib.rs @@ -67,7 +67,7 @@ compile_error!( /// Supports flexible "modes", such as [`AssetMode::Processed`] and /// [`AssetMode::Unprocessed`] that enable using the asset workflow that best suits your project. /// -/// [`AssetSource`]: crate::io::AssetSource +/// [`AssetSource`]: io::AssetSource pub struct AssetPlugin { /// The default file path to use (relative to the project root) for unprocessed assets. pub file_path: String, @@ -88,8 +88,8 @@ pub struct AssetPlugin { pub enum AssetMode { /// Loads assets from their [`AssetSource`]'s default [`AssetReader`] without any "preprocessing". /// - /// [`AssetReader`]: crate::io::AssetReader - /// [`AssetSource`]: crate::io::AssetSource + /// [`AssetReader`]: io::AssetReader + /// [`AssetSource`]: io::AssetSource Unprocessed, /// Assets will be "pre-processed". This enables assets to be imported / converted / optimized ahead of time. /// @@ -102,9 +102,9 @@ pub enum AssetMode { /// be used in combination with the `file_watcher` cargo feature, which enables hot-reloading of assets that have changed. When both features are enabled, /// changes to "original/source assets" will be detected, the asset will be re-processed, and then the final processed asset will be hot-reloaded in the app. /// - /// [`AssetMeta`]: crate::meta::AssetMeta - /// [`AssetSource`]: crate::io::AssetSource - /// [`AssetReader`]: crate::io::AssetReader + /// [`AssetMeta`]: meta::AssetMeta + /// [`AssetSource`]: io::AssetSource + /// [`AssetReader`]: io::AssetReader Processed, } @@ -215,9 +215,9 @@ impl Plugin for AssetPlugin { .init_asset::<()>() .configure_sets( UpdateAssets, - TrackAssets.after(server::handle_internal_asset_events), + TrackAssets.after(handle_internal_asset_events), ) - .add_systems(UpdateAssets, server::handle_internal_asset_events); + .add_systems(UpdateAssets, handle_internal_asset_events); let mut order = app.world.resource_mut::(); order.insert_after(First, UpdateAssets); diff --git a/crates/bevy_asset/src/path.rs b/crates/bevy_asset/src/path.rs index 44e1ebb212dca..f321fc2154a8d 100644 --- a/crates/bevy_asset/src/path.rs +++ b/crates/bevy_asset/src/path.rs @@ -581,10 +581,10 @@ impl TypePath for AssetPath<'static> { Some("AssetPath<'static>") } fn crate_name() -> Option<&'static str> { - Option::None + None } fn module_path() -> Option<&'static str> { - Option::None + None } } impl Typed for AssetPath<'static> { @@ -602,15 +602,15 @@ impl Reflect for AssetPath<'static> { Some(::type_info()) } #[inline] - fn into_any(self: Box) -> Box { + fn into_any(self: Box) -> Box { self } #[inline] - fn as_any(&self) -> &dyn ::core::any::Any { + fn as_any(&self) -> &dyn core::any::Any { self } #[inline] - fn as_any_mut(&mut self) -> &mut dyn ::core::any::Any { + fn as_any_mut(&mut self) -> &mut dyn core::any::Any { self } #[inline] @@ -663,19 +663,19 @@ impl Reflect for AssetPath<'static> { } fn reflect_partial_eq(&self, value: &dyn Reflect) -> Option { let value = ::as_any(value); - if let Some(value) = ::downcast_ref::(value) { - Some(::core::cmp::PartialEq::eq(self, value)) + if let Some(value) = ::downcast_ref::(value) { + Some(PartialEq::eq(self, value)) } else { Some(false) } } - fn debug(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn debug(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { ::core::fmt::Debug::fmt(self, f) } } impl FromReflect for AssetPath<'static> { fn from_reflect(reflect: &dyn Reflect) -> Option { - Some(Clone::clone(::downcast_ref::< + Some(Clone::clone(::downcast_ref::< AssetPath<'static>, >(::as_any(reflect))?)) } diff --git a/crates/bevy_asset/src/processor/mod.rs b/crates/bevy_asset/src/processor/mod.rs index 284b7ab6a1bec..9033a3b08abfa 100644 --- a/crates/bevy_asset/src/processor/mod.rs +++ b/crates/bevy_asset/src/processor/mod.rs @@ -421,7 +421,7 @@ impl AssetProcessor { scope: &'scope bevy_tasks::Scope<'scope, '_, ()>, source: &'scope AssetSource, path: PathBuf, - ) -> bevy_utils::BoxedFuture<'scope, Result<(), AssetReaderError>> { + ) -> BoxedFuture<'scope, Result<(), AssetReaderError>> { Box::pin(async move { if source.reader().is_directory(&path).await? { let mut path_stream = source.reader().read_directory(&path).await?; diff --git a/crates/bevy_audio/src/audio_output.rs b/crates/bevy_audio/src/audio_output.rs index 9870c7496dcaf..7f7e4c581b518 100644 --- a/crates/bevy_audio/src/audio_output.rs +++ b/crates/bevy_audio/src/audio_output.rs @@ -15,7 +15,7 @@ use crate::AudioSink; /// /// ## Note /// -/// Initializing this resource will leak [`rodio::OutputStream`] +/// Initializing this resource will leak [`OutputStream`] /// using [`std::mem::forget`]. /// This is done to avoid storing this in the struct (and making this `!Send`) /// while preventing it from dropping (to avoid halting of audio). diff --git a/crates/bevy_core/src/name.rs b/crates/bevy_core/src/name.rs index 41307cd7ae66f..a150b3f89f68c 100644 --- a/crates/bevy_core/src/name.rs +++ b/crates/bevy_core/src/name.rs @@ -15,7 +15,7 @@ use std::{ /// The hash is eagerly re-computed upon each update to the name. /// /// [`Name`] should not be treated as a globally unique identifier for entities, -/// as multiple entities can have the same name. [`bevy_ecs::entity::Entity`] should be +/// as multiple entities can have the same name. [`Entity`] should be /// used instead as the default unique identifier. #[derive(Reflect, Component, Clone)] #[reflect(Component, Default, Debug)] diff --git a/crates/bevy_core_pipeline/src/tonemapping/mod.rs b/crates/bevy_core_pipeline/src/tonemapping/mod.rs index 87167fd8db585..20c3b87bb6d88 100644 --- a/crates/bevy_core_pipeline/src/tonemapping/mod.rs +++ b/crates/bevy_core_pipeline/src/tonemapping/mod.rs @@ -340,18 +340,16 @@ pub fn get_lut_bind_group_layout_entries() -> [BindGroupLayoutEntryBuilder; 2] { // allow(dead_code) so it doesn't complain when the tonemapping_luts feature is disabled #[allow(dead_code)] fn setup_tonemapping_lut_image(bytes: &[u8], image_type: ImageType) -> Image { - let image_sampler = bevy_render::texture::ImageSampler::Descriptor( - bevy_render::texture::ImageSamplerDescriptor { - label: Some("Tonemapping LUT sampler".to_string()), - address_mode_u: bevy_render::texture::ImageAddressMode::ClampToEdge, - address_mode_v: bevy_render::texture::ImageAddressMode::ClampToEdge, - address_mode_w: bevy_render::texture::ImageAddressMode::ClampToEdge, - mag_filter: bevy_render::texture::ImageFilterMode::Linear, - min_filter: bevy_render::texture::ImageFilterMode::Linear, - mipmap_filter: bevy_render::texture::ImageFilterMode::Linear, - ..default() - }, - ); + let image_sampler = ImageSampler::Descriptor(bevy_render::texture::ImageSamplerDescriptor { + label: Some("Tonemapping LUT sampler".to_string()), + address_mode_u: bevy_render::texture::ImageAddressMode::ClampToEdge, + address_mode_v: bevy_render::texture::ImageAddressMode::ClampToEdge, + address_mode_w: bevy_render::texture::ImageAddressMode::ClampToEdge, + mag_filter: bevy_render::texture::ImageFilterMode::Linear, + min_filter: bevy_render::texture::ImageFilterMode::Linear, + mipmap_filter: bevy_render::texture::ImageFilterMode::Linear, + ..default() + }); Image::from_buffer( bytes, image_type, diff --git a/crates/bevy_diagnostic/src/frame_time_diagnostics_plugin.rs b/crates/bevy_diagnostic/src/frame_time_diagnostics_plugin.rs index 7d7360a3b7a04..11df91687fc84 100644 --- a/crates/bevy_diagnostic/src/frame_time_diagnostics_plugin.rs +++ b/crates/bevy_diagnostic/src/frame_time_diagnostics_plugin.rs @@ -9,7 +9,7 @@ use bevy_time::{Real, Time}; pub struct FrameTimeDiagnosticsPlugin; impl Plugin for FrameTimeDiagnosticsPlugin { - fn build(&self, app: &mut bevy_app::App) { + fn build(&self, app: &mut App) { app.register_diagnostic( Diagnostic::new(Self::FRAME_TIME, "frame_time", 20).with_suffix("ms"), ) diff --git a/crates/bevy_ecs/macros/src/world_query.rs b/crates/bevy_ecs/macros/src/world_query.rs index 1e9e3f847a185..5196d25deb192 100644 --- a/crates/bevy_ecs/macros/src/world_query.rs +++ b/crates/bevy_ecs/macros/src/world_query.rs @@ -27,14 +27,14 @@ pub(crate) fn item_struct( ); match fields { - syn::Fields::Named(_) => quote! { + Fields::Named(_) => quote! { #derive_macro_call #item_attrs #visibility struct #item_struct_name #user_impl_generics_with_world #user_where_clauses_with_world { #(#(#field_attrs)* #field_visibilities #field_idents: <#field_types as #path::query::WorldQuery>::Item<'__w>,)* } }, - syn::Fields::Unnamed(_) => quote! { + Fields::Unnamed(_) => quote! { #derive_macro_call #item_attrs #[automatically_derived] @@ -42,7 +42,7 @@ pub(crate) fn item_struct( #( #field_visibilities <#field_types as #path::query::WorldQuery>::Item<'__w>, )* ); }, - syn::Fields::Unit => quote! { + Fields::Unit => quote! { #item_attrs #visibility type #item_struct_name #user_ty_generics_with_world = #struct_name #user_ty_generics; }, diff --git a/crates/bevy_ecs/macros/src/world_query_data.rs b/crates/bevy_ecs/macros/src/world_query_data.rs index c1bd078389871..e2573ccd1d7ef 100644 --- a/crates/bevy_ecs/macros/src/world_query_data.rs +++ b/crates/bevy_ecs/macros/src/world_query_data.rs @@ -19,7 +19,7 @@ use crate::{ struct WorldQueryDataAttributes { pub is_mutable: bool, - pub derive_args: Punctuated, + pub derive_args: Punctuated, } static MUTABLE_ATTRIBUTE_NAME: &str = "mutable"; @@ -57,7 +57,7 @@ pub fn derive_world_query_data_impl(input: TokenStream) -> TokenStream { ) }); if ident == MUTABLE_ATTRIBUTE_NAME { - if let syn::Meta::Path(_) = meta { + if let Meta::Path(_) = meta { attributes.is_mutable = true; } else { panic!( @@ -66,7 +66,7 @@ pub fn derive_world_query_data_impl(input: TokenStream) -> TokenStream { } } else if ident == DERIVE_ATTRIBUTE_NAME { - if let syn::Meta::List(meta_list) = meta { + if let Meta::List(meta_list) = meta { meta_list.parse_nested_meta(|meta| { attributes.derive_args.push(Meta::Path(meta.path)); Ok(()) diff --git a/crates/bevy_ecs/src/archetype.rs b/crates/bevy_ecs/src/archetype.rs index c9e3a2e4a488e..3e23da6457739 100644 --- a/crates/bevy_ecs/src/archetype.rs +++ b/crates/bevy_ecs/src/archetype.rs @@ -69,7 +69,7 @@ impl ArchetypeRow { /// [`EMPTY`] which is guaranteed to be identical for all Worlds. /// /// [`World`]: crate::world::World -/// [`EMPTY`]: crate::archetype::ArchetypeId::EMPTY +/// [`EMPTY`]: ArchetypeId::EMPTY #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, PartialOrd, Ord)] // SAFETY: Must be repr(transparent) due to the safety requirements on EntityLocation #[repr(transparent)] diff --git a/crates/bevy_ecs/src/component.rs b/crates/bevy_ecs/src/component.rs index bd6cf102cc651..ae1582b547e25 100644 --- a/crates/bevy_ecs/src/component.rs +++ b/crates/bevy_ecs/src/component.rs @@ -269,8 +269,8 @@ impl ComponentInfo { /// [`World`]. /// /// Each time a new `Component` type is registered within a `World` using -/// [`World::init_component`](crate::world::World::init_component) or -/// [`World::init_component_with_descriptor`](crate::world::World::init_component_with_descriptor), +/// [`World::init_component`](World::init_component) or +/// [`World::init_component_with_descriptor`](World::init_component_with_descriptor), /// a corresponding `ComponentId` is created to track it. /// /// While the distinction between `ComponentId` and [`TypeId`] may seem superficial, breaking them @@ -682,7 +682,7 @@ pub struct Tick { impl Tick { /// The maximum relative age for a change tick. - /// The value of this is equal to [`crate::change_detection::MAX_CHANGE_AGE`]. + /// The value of this is equal to [`MAX_CHANGE_AGE`]. /// /// Since change detection will not work for any ticks older than this, /// ticks are periodically scanned to ensure their relative values are below this. diff --git a/crates/bevy_ecs/src/entity/map_entities.rs b/crates/bevy_ecs/src/entity/map_entities.rs index e109b43dd5667..afbfa4bf666e1 100644 --- a/crates/bevy_ecs/src/entity/map_entities.rs +++ b/crates/bevy_ecs/src/entity/map_entities.rs @@ -30,7 +30,7 @@ use bevy_utils::EntityHashMap; /// } /// ``` /// -/// [`World`]: crate::world::World +/// [`World`]: World pub trait MapEntities { /// Updates all [`Entity`] references stored inside using `entity_mapper`. /// diff --git a/crates/bevy_ecs/src/entity/mod.rs b/crates/bevy_ecs/src/entity/mod.rs index 1a548565c216d..cacd61f764f76 100644 --- a/crates/bevy_ecs/src/entity/mod.rs +++ b/crates/bevy_ecs/src/entity/mod.rs @@ -327,7 +327,7 @@ impl SparseSetIndex for Entity { } /// An [`Iterator`] returning a sequence of [`Entity`] values from -/// [`Entities::reserve_entities`](crate::entity::Entities::reserve_entities). +/// [`Entities::reserve_entities`](Entities::reserve_entities). pub struct ReserveEntitiesIterator<'a> { // Metas, so we can recover the current generation for anything in the freelist. meta: &'a [EntityMeta], @@ -363,7 +363,7 @@ impl<'a> Iterator for ReserveEntitiesIterator<'a> { } } -impl<'a> core::iter::ExactSizeIterator for ReserveEntitiesIterator<'a> {} +impl<'a> ExactSizeIterator for ReserveEntitiesIterator<'a> {} impl<'a> core::iter::FusedIterator for ReserveEntitiesIterator<'a> {} /// A [`World`]'s internal metadata store on all of its entities. diff --git a/crates/bevy_ecs/src/event.rs b/crates/bevy_ecs/src/event.rs index 37a6f98532e9d..11a53facb179c 100644 --- a/crates/bevy_ecs/src/event.rs +++ b/crates/bevy_ecs/src/event.rs @@ -346,7 +346,7 @@ impl Events { } } -impl std::iter::Extend for Events { +impl Extend for Events { fn extend(&mut self, iter: I) where I: IntoIterator, diff --git a/crates/bevy_ecs/src/query/fetch.rs b/crates/bevy_ecs/src/query/fetch.rs index f322c5d14572b..00df1fe63e17c 100644 --- a/crates/bevy_ecs/src/query/fetch.rs +++ b/crates/bevy_ecs/src/query/fetch.rs @@ -1589,7 +1589,7 @@ mod tests { fn ignored_system(_: Query>) {} - crate::system::assert_is_system(ignored_system); + assert_is_system(ignored_system); } // Ensures that each field of a `WorldQuery` struct's read-only variant @@ -1614,7 +1614,7 @@ mod tests { } } - crate::system::assert_is_system(my_system); + assert_is_system(my_system); } // Ensures that metadata types generated by the WorldQuery macro @@ -1642,6 +1642,6 @@ mod tests { fn client_system(_: Query>) {} - crate::system::assert_is_system(client_system); + assert_is_system(client_system); } } diff --git a/crates/bevy_ecs/src/query/filter.rs b/crates/bevy_ecs/src/query/filter.rs index a02f9f703a91c..dcc2cedeea20b 100644 --- a/crates/bevy_ecs/src/query/filter.rs +++ b/crates/bevy_ecs/src/query/filter.rs @@ -67,15 +67,11 @@ use std::{cell::UnsafeCell, marker::PhantomData}; /// ``` /// /// [`fetch`]: Self::fetch -/// [`Changed`]: crate::query::Changed /// [`matches_component_set`]: Self::matches_component_set -/// [`Or`]: crate::query::Or /// [`Query`]: crate::system::Query /// [`State`]: Self::State /// [`update_archetype_component_access`]: Self::update_archetype_component_access /// [`update_component_access`]: Self::update_component_access -/// [`With`]: crate::query::With -/// [`Without`]: crate::query::Without pub trait WorldQueryFilter: WorldQuery { /// Returns true if (and only if) this Filter relies strictly on archetypes to limit which diff --git a/crates/bevy_ecs/src/query/state.rs b/crates/bevy_ecs/src/query/state.rs index dbd69e6497844..d4afbfe5ac9c0 100644 --- a/crates/bevy_ecs/src/query/state.rs +++ b/crates/bevy_ecs/src/query/state.rs @@ -43,7 +43,7 @@ pub struct QueryState { par_iter_span: Span, } -impl std::fmt::Debug for QueryState { +impl fmt::Debug for QueryState { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("QueryState") .field("world_id", &self.world_id) diff --git a/crates/bevy_ecs/src/query/world_query.rs b/crates/bevy_ecs/src/query/world_query.rs index 8e867750a6050..1641f5bed1bd2 100644 --- a/crates/bevy_ecs/src/query/world_query.rs +++ b/crates/bevy_ecs/src/query/world_query.rs @@ -45,12 +45,12 @@ pub unsafe trait WorldQuery { /// or a tuple of such things. type Item<'a>; - /// Per archetype/table state used by this [`WorldQuery`] to fetch [`Self::Item`](crate::query::WorldQuery::Item) + /// Per archetype/table state used by this [`WorldQuery`] to fetch [`Self::Item`](WorldQuery::Item) type Fetch<'a>: Clone; - /// State used to construct a [`Self::Fetch`](crate::query::WorldQuery::Fetch). This will be cached inside [`QueryState`](crate::query::QueryState), + /// State used to construct a [`Self::Fetch`](WorldQuery::Fetch). This will be cached inside [`QueryState`](crate::query::QueryState), /// so it is best to move as much data / computation here as possible to reduce the cost of - /// constructing [`Self::Fetch`](crate::query::WorldQuery::Fetch). + /// constructing [`Self::Fetch`](WorldQuery::Fetch). type State: Send + Sync + Sized; /// This function manually implements subtyping for the query items. diff --git a/crates/bevy_ecs/src/reflect/bundle.rs b/crates/bevy_ecs/src/reflect/bundle.rs index 4c7e9ed1f777b..c848cec289ae7 100644 --- a/crates/bevy_ecs/src/reflect/bundle.rs +++ b/crates/bevy_ecs/src/reflect/bundle.rs @@ -54,7 +54,7 @@ impl ReflectBundle { (self.0.from_world)(world) } - /// Insert a reflected [`Bundle`] into the entity like [`insert()`](crate::world::EntityWorldMut::insert). + /// Insert a reflected [`Bundle`] into the entity like [`insert()`](EntityWorldMut::insert). pub fn insert(&self, entity: &mut EntityWorldMut, bundle: &dyn Reflect) { (self.0.insert)(entity, bundle); } @@ -118,7 +118,7 @@ impl ReflectBundle { /// and copy the subset of function pointers you care about. /// /// [`TypeRegistration::data::`]: bevy_reflect::TypeRegistration::data - /// [`TypeRegistry::get`]: bevy_reflect::TypeRegistry::get + /// [`TypeRegistry::get`]: TypeRegistry::get pub fn fn_pointers(&self) -> &ReflectBundleFns { &self.0 } diff --git a/crates/bevy_ecs/src/reflect/component.rs b/crates/bevy_ecs/src/reflect/component.rs index c86f34b22b3d6..d91e367c41b5e 100644 --- a/crates/bevy_ecs/src/reflect/component.rs +++ b/crates/bevy_ecs/src/reflect/component.rs @@ -125,7 +125,7 @@ impl ReflectComponent { (self.0.from_world)(world) } - /// Insert a reflected [`Component`] into the entity like [`insert()`](crate::world::EntityWorldMut::insert). + /// Insert a reflected [`Component`] into the entity like [`insert()`](EntityWorldMut::insert). pub fn insert(&self, entity: &mut EntityWorldMut, component: &dyn Reflect) { (self.0.insert)(entity, component); } diff --git a/crates/bevy_ecs/src/removal_detection.rs b/crates/bevy_ecs/src/removal_detection.rs index 3bfed91935643..aa1bb8fb7d137 100644 --- a/crates/bevy_ecs/src/removal_detection.rs +++ b/crates/bevy_ecs/src/removal_detection.rs @@ -110,10 +110,10 @@ impl RemovedComponentEvents { /// /// If you are using `bevy_ecs` as a standalone crate, /// note that the `RemovedComponents` list will not be automatically cleared for you, -/// and will need to be manually flushed using [`World::clear_trackers`](crate::world::World::clear_trackers) +/// and will need to be manually flushed using [`World::clear_trackers`](World::clear_trackers) /// /// For users of `bevy` and `bevy_app`, this is automatically done in `bevy_app::App::update`. -/// For the main world, [`World::clear_trackers`](crate::world::World::clear_trackers) is run after the main schedule is run and after +/// For the main world, [`World::clear_trackers`](World::clear_trackers) is run after the main schedule is run and after /// `SubApp`'s have run. /// /// # Examples diff --git a/crates/bevy_ecs/src/schedule/condition.rs b/crates/bevy_ecs/src/schedule/condition.rs index 4212e1be17cd7..916fc12ceaac3 100644 --- a/crates/bevy_ecs/src/schedule/condition.rs +++ b/crates/bevy_ecs/src/schedule/condition.rs @@ -10,7 +10,7 @@ pub type BoxedCondition = Box>; /// A system that determines if one or more scheduled systems should run. /// -/// Implemented for functions and closures that convert into [`System`](crate::system::System) +/// Implemented for functions and closures that convert into [`System`](System) /// with [read-only](crate::system::ReadOnlySystemParam) parameters. /// /// # Marker type parameter diff --git a/crates/bevy_ecs/src/schedule/executor/multi_threaded.rs b/crates/bevy_ecs/src/schedule/executor/multi_threaded.rs index 36eb76a94abca..9e0fa0cd238b0 100644 --- a/crates/bevy_ecs/src/schedule/executor/multi_threaded.rs +++ b/crates/bevy_ecs/src/schedule/executor/multi_threaded.rs @@ -683,7 +683,7 @@ fn apply_deferred( unapplied_systems: &FixedBitSet, systems: &[SyncUnsafeCell], world: &mut World, -) -> Result<(), Box> { +) -> Result<(), Box> { for system_index in unapplied_systems.ones() { // SAFETY: none of these systems are running, no other references exist let system = unsafe { &mut *systems[system_index].get() }; diff --git a/crates/bevy_ecs/src/schedule/graph_utils.rs b/crates/bevy_ecs/src/schedule/graph_utils.rs index dd262877e54ab..ee35212464b7d 100644 --- a/crates/bevy_ecs/src/schedule/graph_utils.rs +++ b/crates/bevy_ecs/src/schedule/graph_utils.rs @@ -152,7 +152,7 @@ where map.insert(node, i); topsorted.add_node(node); // insert nodes as successors to their predecessors - for pred in graph.neighbors_directed(node, Direction::Incoming) { + for pred in graph.neighbors_directed(node, Incoming) { topsorted.add_edge(pred, node, ()); } } @@ -177,7 +177,7 @@ where for a in topsorted.nodes().rev() { let index_a = *map.get(&a).unwrap(); // iterate their successors in topological order - for b in topsorted.neighbors_directed(a, Direction::Outgoing) { + for b in topsorted.neighbors_directed(a, Outgoing) { let index_b = *map.get(&b).unwrap(); debug_assert!(index_a < index_b); if !visited[index_b] { @@ -187,7 +187,7 @@ where reachable.insert(index(index_a, index_b, n)); let successors = transitive_closure - .neighbors_directed(b, Direction::Outgoing) + .neighbors_directed(b, Outgoing) .collect::>(); for c in successors { let index_c = *map.get(&c).unwrap(); diff --git a/crates/bevy_ecs/src/schedule/schedule.rs b/crates/bevy_ecs/src/schedule/schedule.rs index c5012f8f1491b..5b042590d5cf2 100644 --- a/crates/bevy_ecs/src/schedule/schedule.rs +++ b/crates/bevy_ecs/src/schedule/schedule.rs @@ -276,7 +276,7 @@ impl Schedule { /// Runs all systems in this schedule on the `world`, using its current execution strategy. pub fn run(&mut self, world: &mut World) { #[cfg(feature = "trace")] - let _span = bevy_utils::tracing::info_span!("schedule", name = ?self.name).entered(); + let _span = info_span!("schedule", name = ?self.name).entered(); world.check_change_ticks(); self.initialize(world) @@ -989,7 +989,7 @@ impl ScheduleGraph { let mut systems = Vec::new(); let mut system_bitset = FixedBitSet::with_capacity(self.systems.len()); - for child in hierarchy_graph.neighbors_directed(id, Direction::Outgoing) { + for child in hierarchy_graph.neighbors_directed(id, Outgoing) { match child { NodeId::System(_) => { systems.push(child); @@ -1020,19 +1020,19 @@ impl ScheduleGraph { let mut temp = Vec::new(); for (&set, systems) in set_systems { if systems.is_empty() { - for a in dependency_flattened.neighbors_directed(set, Direction::Incoming) { - for b in dependency_flattened.neighbors_directed(set, Direction::Outgoing) { + for a in dependency_flattened.neighbors_directed(set, Incoming) { + for b in dependency_flattened.neighbors_directed(set, Outgoing) { temp.push((a, b)); } } } else { - for a in dependency_flattened.neighbors_directed(set, Direction::Incoming) { + for a in dependency_flattened.neighbors_directed(set, Incoming) { for &sys in systems { temp.push((a, sys)); } } - for b in dependency_flattened.neighbors_directed(set, Direction::Outgoing) { + for b in dependency_flattened.neighbors_directed(set, Outgoing) { for &sys in systems { temp.push((sys, b)); } @@ -1166,12 +1166,12 @@ impl ScheduleGraph { for &sys_id in &dg_system_ids { let num_dependencies = dependency_flattened_dag .graph - .neighbors_directed(sys_id, Direction::Incoming) + .neighbors_directed(sys_id, Incoming) .count(); let dependents = dependency_flattened_dag .graph - .neighbors_directed(sys_id, Direction::Outgoing) + .neighbors_directed(sys_id, Outgoing) .map(|dep_id| dg_system_idx_map[&dep_id]) .collect::>(); @@ -1348,7 +1348,7 @@ impl ScheduleGraph { "({})", self.hierarchy .graph - .edges_directed(*id, Direction::Outgoing) + .edges_directed(*id, Outgoing) // never get the sets of the members or this will infinite recurse when the report_sets setting is on. .map(|(_, member_id, _)| self.get_node_name_inner(&member_id, false)) .reduce(|a, b| format!("{a}, {b}")) @@ -1556,14 +1556,8 @@ impl ScheduleGraph { if set.is_system_type() { let instances = systems.len(); let ambiguous_with = self.ambiguous_with.edges(id); - let before = self - .dependency - .graph - .edges_directed(id, Direction::Incoming); - let after = self - .dependency - .graph - .edges_directed(id, Direction::Outgoing); + let before = self.dependency.graph.edges_directed(id, Incoming); + let after = self.dependency.graph.edges_directed(id, Outgoing); let relations = before.count() + after.count() + ambiguous_with.count(); if instances > 1 && relations > 0 { return Err(ScheduleBuildError::SystemTypeSetAmbiguity( @@ -1649,7 +1643,7 @@ impl ScheduleGraph { } fn traverse_sets_containing_node(&self, id: NodeId, f: &mut impl FnMut(NodeId) -> bool) { - for (set_id, _, _) in self.hierarchy.graph.edges_directed(id, Direction::Incoming) { + for (set_id, _, _) in self.hierarchy.graph.edges_directed(id, Incoming) { if f(set_id) { self.traverse_sets_containing_node(set_id, f); } diff --git a/crates/bevy_ecs/src/schedule/set.rs b/crates/bevy_ecs/src/schedule/set.rs index 1001f20189dcf..e17561e737404 100644 --- a/crates/bevy_ecs/src/schedule/set.rs +++ b/crates/bevy_ecs/src/schedule/set.rs @@ -109,7 +109,7 @@ impl SystemSet for SystemTypeSet { } fn dyn_hash(&self, mut state: &mut dyn Hasher) { - std::any::TypeId::of::().hash(&mut state); + TypeId::of::().hash(&mut state); self.hash(&mut state); } } @@ -136,7 +136,7 @@ impl SystemSet for AnonymousSet { } fn dyn_hash(&self, mut state: &mut dyn Hasher) { - std::any::TypeId::of::().hash(&mut state); + TypeId::of::().hash(&mut state); self.hash(&mut state); } diff --git a/crates/bevy_ecs/src/storage/blob_vec.rs b/crates/bevy_ecs/src/storage/blob_vec.rs index 6875b14cc76bf..17d50c1a57fe3 100644 --- a/crates/bevy_ecs/src/storage/blob_vec.rs +++ b/crates/bevy_ecs/src/storage/blob_vec.rs @@ -51,7 +51,7 @@ impl BlobVec { /// If `drop` is `None`, the items will be leaked. This should generally be set as None based on [`needs_drop`]. /// /// [`needs_drop`]: core::mem::needs_drop - /// [`Drop`]: core::ops::Drop + /// [`Drop`]: Drop pub unsafe fn new( item_layout: Layout, drop: Option)>, diff --git a/crates/bevy_ecs/src/storage/table.rs b/crates/bevy_ecs/src/storage/table.rs index 6da4504d40add..f6abbd3091caf 100644 --- a/crates/bevy_ecs/src/storage/table.rs +++ b/crates/bevy_ecs/src/storage/table.rs @@ -72,7 +72,7 @@ impl TableId { /// [`Archetype`]: crate::archetype::Archetype /// [`Archetype::entity_table_row`]: crate::archetype::Archetype::entity_table_row /// [`Archetype::table_id`]: crate::archetype::Archetype::table_id -/// [`Entity`]: crate::entity::Entity +/// [`Entity`]: Entity #[derive(Debug, Clone, Copy, PartialEq, Eq)] // SAFETY: Must be repr(transparent) due to the safety requirements on EntityLocation #[repr(transparent)] @@ -192,7 +192,7 @@ impl Column { /// # Safety /// `row` must be within the range `[0, self.len())`. /// - /// [`Drop`]: std::ops::Drop + /// [`Drop`]: Drop #[inline] pub(crate) unsafe fn swap_remove_unchecked(&mut self, row: TableRow) { self.data.swap_remove_and_drop_unchecked(row.index()); @@ -312,7 +312,7 @@ impl Column { /// # Safety /// The type `T` must be the type of the items in this column. /// - /// [`UnsafeCell`]: std::cell::UnsafeCell + /// [`UnsafeCell`]: UnsafeCell pub unsafe fn get_data_slice(&self) -> &[UnsafeCell] { self.data.get_slice() } @@ -323,7 +323,7 @@ impl Column { /// Users of this API must ensure that accesses to each individual element /// adhere to the safety invariants of [`UnsafeCell`]. /// - /// [`UnsafeCell`]: std::cell::UnsafeCell + /// [`UnsafeCell`]: UnsafeCell #[inline] pub fn get_added_ticks_slice(&self) -> &[UnsafeCell] { &self.added_ticks @@ -335,7 +335,7 @@ impl Column { /// Users of this API must ensure that accesses to each individual element /// adhere to the safety invariants of [`UnsafeCell`]. /// - /// [`UnsafeCell`]: std::cell::UnsafeCell + /// [`UnsafeCell`]: UnsafeCell #[inline] pub fn get_changed_ticks_slice(&self) -> &[UnsafeCell] { &self.changed_ticks @@ -412,7 +412,7 @@ impl Column { /// Users of this API must ensure that accesses to each individual element /// adhere to the safety invariants of [`UnsafeCell`]. /// - /// [`UnsafeCell`]: std::cell::UnsafeCell + /// [`UnsafeCell`]: UnsafeCell #[inline] pub fn get_added_tick(&self, row: TableRow) -> Option<&UnsafeCell> { self.added_ticks.get(row.index()) @@ -426,7 +426,7 @@ impl Column { /// Users of this API must ensure that accesses to each individual element /// adhere to the safety invariants of [`UnsafeCell`]. /// - /// [`UnsafeCell`]: std::cell::UnsafeCell + /// [`UnsafeCell`]: UnsafeCell #[inline] pub fn get_changed_tick(&self, row: TableRow) -> Option<&UnsafeCell> { self.changed_ticks.get(row.index()) diff --git a/crates/bevy_ecs/src/system/commands/mod.rs b/crates/bevy_ecs/src/system/commands/mod.rs index 1f9421474f0e8..c37d223e51991 100644 --- a/crates/bevy_ecs/src/system/commands/mod.rs +++ b/crates/bevy_ecs/src/system/commands/mod.rs @@ -527,7 +527,7 @@ impl<'w, 's> Commands<'w, 's> { /// Systems are ran in an exclusive and single threaded way. /// Running slow systems can become a bottleneck. /// - /// Calls [`World::run_system`](crate::system::World::run_system). + /// Calls [`World::run_system`](World::run_system). /// /// There is no way to get the output of a system when run as a command, because the /// execution of the system happens later. To get the output of a system, use @@ -540,7 +540,7 @@ impl<'w, 's> Commands<'w, 's> { /// Systems are ran in an exclusive and single threaded way. /// Running slow systems can become a bottleneck. /// - /// Calls [`World::run_system_with_input`](crate::system::World::run_system_with_input). + /// Calls [`World::run_system_with_input`](World::run_system_with_input). /// /// There is no way to get the output of a system when run as a command, because the /// execution of the system happens later. To get the output of a system, use @@ -812,7 +812,7 @@ impl<'w, 's, 'a> EntityCommands<'w, 's, 'a> { /// Removes a [`Bundle`] of components from the entity. /// - /// See [`EntityWorldMut::remove`](crate::world::EntityWorldMut::remove) for more + /// See [`EntityWorldMut::remove`](EntityWorldMut::remove) for more /// details. /// /// # Example diff --git a/crates/bevy_ecs/src/system/function_system.rs b/crates/bevy_ecs/src/system/function_system.rs index 02f1db9cb80b9..6bd67fb89d8fc 100644 --- a/crates/bevy_ecs/src/system/function_system.rs +++ b/crates/bevy_ecs/src/system/function_system.rs @@ -75,7 +75,7 @@ impl SystemMeta { /// /// This is a powerful and convenient tool for working with exclusive world access, /// allowing you to fetch data from the [`World`] as if you were running a [`System`]. -/// However, simply calling `world::run_system(my_system)` using a [`World::run_system`](crate::system::World::run_system) +/// However, simply calling `world::run_system(my_system)` using a [`World::run_system`](World::run_system) /// can be significantly simpler and ensures that change detection and command flushing work as expected. /// /// Borrow-checking is handled for you, allowing you to mutably access multiple compatible system parameters at once, @@ -92,7 +92,7 @@ impl SystemMeta { /// - [`Local`](crate::system::Local) variables that hold state /// - [`EventReader`](crate::event::EventReader) system parameters, which rely on a [`Local`](crate::system::Local) to track which events have been seen /// -/// Note that this is automatically handled for you when using a [`World::run_system`](crate::system::World::run_system). +/// Note that this is automatically handled for you when using a [`World::run_system`](World::run_system). /// /// # Example /// diff --git a/crates/bevy_ecs/src/system/mod.rs b/crates/bevy_ecs/src/system/mod.rs index c50798d623097..b2fced3650577 100644 --- a/crates/bevy_ecs/src/system/mod.rs +++ b/crates/bevy_ecs/src/system/mod.rs @@ -91,7 +91,7 @@ //! - [`EventWriter`](crate::event::EventWriter) //! - [`NonSend`] and `Option` //! - [`NonSendMut`] and `Option` -//! - [`&World`](crate::world::World) +//! - [`&World`](World) //! - [`RemovedComponents`](crate::removal_detection::RemovedComponents) //! - [`SystemName`] //! - [`SystemChangeTick`] @@ -174,7 +174,7 @@ pub trait IntoSystem: Sized { /// # use bevy_ecs::prelude::*; /// # let mut schedule = Schedule::default(); /// // Ignores the output of a system that may fail. - /// schedule.add_systems(my_system.map(std::mem::drop)); + /// schedule.add_systems(my_system.map(drop)); /// # let mut world = World::new(); /// # world.insert_resource(T); /// # schedule.run(&mut world); @@ -1015,7 +1015,7 @@ mod tests { let archetype = archetypes.get(location.archetype_id).unwrap(); let archetype_components = archetype.components().collect::>(); let bundle_id = bundles - .get_id(std::any::TypeId::of::<(W, W)>()) + .get_id(TypeId::of::<(W, W)>()) .expect("Bundle used to spawn entity should exist"); let bundle_info = bundles.get(bundle_id).unwrap(); let mut bundle_components = bundle_info.components().to_vec(); @@ -1608,7 +1608,7 @@ mod tests { } assert_is_system(returning::>.map(Result::unwrap)); - assert_is_system(returning::>.map(std::mem::drop)); + assert_is_system(returning::>.map(drop)); assert_is_system(returning::<&str>.map(u64::from_str).map(Result::unwrap)); assert_is_system(exclusive_in_out::<(), Result<(), std::io::Error>>.map(bevy_utils::error)); assert_is_system(returning::.pipe(exclusive_in_out::)); diff --git a/crates/bevy_ecs/src/system/query.rs b/crates/bevy_ecs/src/system/query.rs index f4f6e651dfebd..54f20848cbc99 100644 --- a/crates/bevy_ecs/src/system/query.rs +++ b/crates/bevy_ecs/src/system/query.rs @@ -155,7 +155,7 @@ use std::{any::TypeId, borrow::Borrow}; /// enemy_query: Query<&mut Health, With>, /// ) /// # {} -/// # let mut randomize_health_system = bevy_ecs::system::IntoSystem::into_system(randomize_health); +/// # let mut randomize_health_system = IntoSystem::into_system(randomize_health); /// # let mut world = World::new(); /// # randomize_health_system.initialize(&mut world); /// # randomize_health_system.run((), &mut world); @@ -178,7 +178,7 @@ use std::{any::TypeId, borrow::Borrow}; /// enemy_query: Query<&mut Health, (With, Without)>, /// ) /// # {} -/// # let mut randomize_health_system = bevy_ecs::system::IntoSystem::into_system(randomize_health); +/// # let mut randomize_health_system = IntoSystem::into_system(randomize_health); /// # let mut world = World::new(); /// # randomize_health_system.initialize(&mut world); /// # randomize_health_system.run((), &mut world); @@ -296,7 +296,7 @@ use std::{any::TypeId, borrow::Borrow}; /// [binomial coefficient]: https://en.wikipedia.org/wiki/Binomial_coefficient /// [`Changed`]: crate::query::Changed /// [components]: crate::component::Component -/// [entity identifiers]: crate::entity::Entity +/// [entity identifiers]: Entity /// [`EntityRef`]: crate::world::EntityRef /// [`for_each`]: Self::for_each /// [`for_each_mut`]: Self::for_each_mut diff --git a/crates/bevy_ecs/src/system/system.rs b/crates/bevy_ecs/src/system/system.rs index fd03b94fa2b55..d31336b165d94 100644 --- a/crates/bevy_ecs/src/system/system.rs +++ b/crates/bevy_ecs/src/system/system.rs @@ -166,8 +166,8 @@ impl Debug for dyn System { /// This function is not an efficient method of running systems and its meant to be used as a utility /// for testing and/or diagnostics. /// -/// Systems called through [`run_system_once`](crate::system::RunSystemOnce::run_system_once) do not hold onto any state, -/// as they are created and destroyed every time [`run_system_once`](crate::system::RunSystemOnce::run_system_once) is called. +/// Systems called through [`run_system_once`](RunSystemOnce::run_system_once) do not hold onto any state, +/// as they are created and destroyed every time [`run_system_once`](RunSystemOnce::run_system_once) is called. /// Practically, this means that [`Local`](crate::system::Local) variables are /// reset on every run and change detection does not work. /// @@ -187,7 +187,7 @@ impl Debug for dyn System { /// world.run_system_once(increment); // still prints 1 /// ``` /// -/// If you do need systems to hold onto state between runs, use the [`World::run_system`](crate::system::World::run_system) +/// If you do need systems to hold onto state between runs, use the [`World::run_system`](World::run_system) /// and run the system by their [`SystemId`](crate::system::SystemId). /// /// # Usage diff --git a/crates/bevy_ecs/src/system/system_param.rs b/crates/bevy_ecs/src/system/system_param.rs index 84a37c9a75976..1e6dd707d452c 100644 --- a/crates/bevy_ecs/src/system/system_param.rs +++ b/crates/bevy_ecs/src/system/system_param.rs @@ -260,7 +260,7 @@ fn assert_component_access_compatibility( /// // ... /// } /// # -/// # let mut bad_system_system = bevy_ecs::system::IntoSystem::into_system(bad_system); +/// # let mut bad_system_system = IntoSystem::into_system(bad_system); /// # let mut world = World::new(); /// # bad_system_system.initialize(&mut world); /// # bad_system_system.run((), &mut world); @@ -403,7 +403,7 @@ impl_param_set!(); /// } /// ``` /// -/// [`SyncCell`]: bevy_utils::synccell::SyncCell +/// [`SyncCell`]: SyncCell /// [`Exclusive`]: https://doc.rust-lang.org/nightly/std/sync/struct.Exclusive.html pub trait Resource: Send + Sync + 'static {} @@ -1245,7 +1245,7 @@ unsafe impl<'a> SystemParam for &'a Bundles { /// /// Component change ticks that are more recent than `last_run` will be detected by the system. /// Those can be read by calling [`last_changed`](crate::change_detection::DetectChanges::last_changed) -/// on a [`Mut`](crate::change_detection::Mut) or [`ResMut`](crate::change_detection::ResMut). +/// on a [`Mut`](crate::change_detection::Mut) or [`ResMut`](ResMut). #[derive(Debug)] pub struct SystemChangeTick { last_run: Tick, diff --git a/crates/bevy_ecs/src/system/system_registry.rs b/crates/bevy_ecs/src/system/system_registry.rs index 54e8e6e177dc8..5a9d7269d1032 100644 --- a/crates/bevy_ecs/src/system/system_registry.rs +++ b/crates/bevy_ecs/src/system/system_registry.rs @@ -322,7 +322,7 @@ pub struct RunSystemWithInput { /// Running slow systems can become a bottleneck. /// /// If the system needs an [`In<_>`](crate::system::In) input value to run, use the -/// [`crate::system::RunSystemWithInput`] type instead. +/// [`RunSystemWithInput`] type instead. /// /// There is no way to get the output of a system when run as a command, because the /// execution of the system happens later. To get the output of a system, use diff --git a/crates/bevy_ecs/src/world/identifier.rs b/crates/bevy_ecs/src/world/identifier.rs index 626964577d83f..2f5f2e9b914ef 100644 --- a/crates/bevy_ecs/src/world/identifier.rs +++ b/crates/bevy_ecs/src/world/identifier.rs @@ -53,7 +53,7 @@ unsafe impl SystemParam for WorldId { type Item<'world, 'state> = WorldId; - fn init_state(_: &mut super::World, _: &mut crate::system::SystemMeta) -> Self::State {} + fn init_state(_: &mut World, _: &mut crate::system::SystemMeta) -> Self::State {} unsafe fn get_param<'world, 'state>( _: &'state mut Self::State, diff --git a/crates/bevy_ecs/src/world/mod.rs b/crates/bevy_ecs/src/world/mod.rs index 1b0eb9d07d71f..397f38bc795f3 100644 --- a/crates/bevy_ecs/src/world/mod.rs +++ b/crates/bevy_ecs/src/world/mod.rs @@ -1799,7 +1799,7 @@ impl World { resources.check_change_ticks(change_tick); non_send_resources.check_change_ticks(change_tick); - if let Some(mut schedules) = self.get_resource_mut::() { + if let Some(mut schedules) = self.get_resource_mut::() { schedules.check_change_ticks(change_tick); } @@ -2293,7 +2293,7 @@ mod tests { world.insert_resource(TestResource(42)); let component_id = world .components() - .get_resource_id(std::any::TypeId::of::()) + .get_resource_id(TypeId::of::()) .unwrap(); let resource = world.get_resource_by_id(component_id).unwrap(); @@ -2309,7 +2309,7 @@ mod tests { world.insert_resource(TestResource(42)); let component_id = world .components() - .get_resource_id(std::any::TypeId::of::()) + .get_resource_id(TypeId::of::()) .unwrap(); { @@ -2342,7 +2342,7 @@ mod tests { Some(|ptr| { let data = ptr.read::<[u8; 8]>(); assert_eq!(data, [0, 1, 2, 3, 4, 5, 6, 7]); - DROP_COUNT.fetch_add(1, std::sync::atomic::Ordering::SeqCst); + DROP_COUNT.fetch_add(1, Ordering::SeqCst); }), ) }; @@ -2368,7 +2368,7 @@ mod tests { assert!(world.remove_resource_by_id(component_id).is_some()); - assert_eq!(DROP_COUNT.load(std::sync::atomic::Ordering::SeqCst), 1); + assert_eq!(DROP_COUNT.load(Ordering::SeqCst), 1); } #[derive(Resource)] diff --git a/crates/bevy_ecs/src/world/unsafe_world_cell.rs b/crates/bevy_ecs/src/world/unsafe_world_cell.rs index 4359e25a699c2..25d5ac62c0305 100644 --- a/crates/bevy_ecs/src/world/unsafe_world_cell.rs +++ b/crates/bevy_ecs/src/world/unsafe_world_cell.rs @@ -144,7 +144,7 @@ impl<'w> UnsafeWorldCell<'w> { unsafe { &mut *self.0 } } - /// Gets a reference to the [`&World`](crate::world::World) this [`UnsafeWorldCell`] belongs to. + /// Gets a reference to the [`&World`](World) this [`UnsafeWorldCell`] belongs to. /// This can be used for arbitrary shared/readonly access. /// /// # Safety diff --git a/crates/bevy_gilrs/src/rumble.rs b/crates/bevy_gilrs/src/rumble.rs index 2a1a016a2fa2d..2b1eb68aedbf2 100644 --- a/crates/bevy_gilrs/src/rumble.rs +++ b/crates/bevy_gilrs/src/rumble.rs @@ -53,7 +53,7 @@ fn get_base_effects( strong_motor, }: GamepadRumbleIntensity, duration: Duration, -) -> Vec { +) -> Vec { let mut effects = Vec::new(); if strong_motor > 0. { effects.push(BaseEffect { diff --git a/crates/bevy_gltf/src/loader.rs b/crates/bevy_gltf/src/loader.rs index ce07805a4276a..938da9a284b9e 100644 --- a/crates/bevy_gltf/src/loader.rs +++ b/crates/bevy_gltf/src/loader.rs @@ -186,8 +186,8 @@ async fn load_gltf<'a, 'b, 'c>( let reader = channel.reader(|buffer| Some(&buffer_data[buffer.index()])); let keyframe_timestamps: Vec = if let Some(inputs) = reader.read_inputs() { match inputs { - gltf::accessor::Iter::Standard(times) => times.collect(), - gltf::accessor::Iter::Sparse(_) => { + Iter::Standard(times) => times.collect(), + Iter::Sparse(_) => { warn!("Sparse accessor not supported for animation sampler input"); continue; } @@ -439,7 +439,7 @@ async fn load_gltf<'a, 'b, 'c>( "Missing vertex tangents, computing them using the mikktspace algorithm" ); if let Err(err) = mesh.generate_tangents() { - bevy_log::warn!( + warn!( "Failed to generate vertex tangents using the mikktspace algorithm: {:?}", err ); @@ -485,7 +485,7 @@ async fn load_gltf<'a, 'b, 'c>( .and_then(|i| meshes.get(i).cloned()), transform: match node.transform() { gltf::scene::Transform::Matrix { matrix } => { - Transform::from_matrix(bevy_math::Mat4::from_cols_array_2d(&matrix)) + Transform::from_matrix(Mat4::from_cols_array_2d(&matrix)) } gltf::scene::Transform::Decomposed { translation, @@ -510,7 +510,7 @@ async fn load_gltf<'a, 'b, 'c>( let nodes = resolve_node_hierarchy(nodes_intermediate, load_context.path()) .into_iter() .map(|(label, node)| load_context.add_labeled_asset(label, node)) - .collect::>>(); + .collect::>>(); let named_nodes = named_nodes_intermediate .into_iter() .filter_map(|(name, index)| { @@ -637,7 +637,7 @@ async fn load_gltf<'a, 'b, 'c>( } fn get_gltf_extras(extras: &gltf::json::Extras) -> Option { - extras.as_ref().map(|extras| super::GltfExtras { + extras.as_ref().map(|extras| GltfExtras { value: extras.get().to_string(), }) } @@ -856,7 +856,7 @@ fn load_material( /// Loads a glTF node. #[allow(clippy::too_many_arguments)] fn load_node( - gltf_node: &gltf::Node, + gltf_node: &Node, world_builder: &mut WorldChildBuilder, root_load_context: &LoadContext, load_context: &mut LoadContext, @@ -881,7 +881,7 @@ fn load_node( node.insert(node_name(gltf_node)); if let Some(extras) = gltf_node.extras() { - node.insert(super::GltfExtras { + node.insert(GltfExtras { value: extras.get().to_string(), }); } @@ -985,7 +985,7 @@ fn load_node( )); if let Some(extras) = primitive.extras() { - mesh_entity.insert(super::GltfExtras { + mesh_entity.insert(GltfExtras { value: extras.get().to_string(), }); } @@ -1015,7 +1015,7 @@ fn load_node( entity.insert(Name::new(name.to_string())); } if let Some(extras) = light.extras() { - entity.insert(super::GltfExtras { + entity.insert(GltfExtras { value: extras.get().to_string(), }); } @@ -1038,7 +1038,7 @@ fn load_node( entity.insert(Name::new(name.to_string())); } if let Some(extras) = light.extras() { - entity.insert(super::GltfExtras { + entity.insert(GltfExtras { value: extras.get().to_string(), }); } @@ -1066,7 +1066,7 @@ fn load_node( entity.insert(Name::new(name.to_string())); } if let Some(extras) = light.extras() { - entity.insert(super::GltfExtras { + entity.insert(GltfExtras { value: extras.get().to_string(), }); } @@ -1134,7 +1134,7 @@ fn morph_targets_label(mesh: &gltf::Mesh, primitive: &Primitive) -> String { } /// Returns the label for the `material`. -fn material_label(material: &gltf::Material, is_scale_inverted: bool) -> String { +fn material_label(material: &Material, is_scale_inverted: bool) -> String { if let Some(index) = material.index() { format!( "Material{index}{}", @@ -1174,7 +1174,7 @@ fn texture_handle(load_context: &mut LoadContext, texture: &gltf::Texture) -> Ha } /// Returns the label for the `node`. -fn node_label(node: &gltf::Node) -> String { +fn node_label(node: &Node) -> String { format!("Node{}", node.index()) } @@ -1233,7 +1233,7 @@ fn texture_sampler(texture: &gltf::Texture) -> ImageSamplerDescriptor { } /// Maps the texture address mode form glTF to wgpu. -fn texture_address_mode(gltf_address_mode: &gltf::texture::WrappingMode) -> ImageAddressMode { +fn texture_address_mode(gltf_address_mode: &WrappingMode) -> ImageAddressMode { match gltf_address_mode { WrappingMode::ClampToEdge => ImageAddressMode::ClampToEdge, WrappingMode::Repeat => ImageAddressMode::Repeat, diff --git a/crates/bevy_input/src/keyboard.rs b/crates/bevy_input/src/keyboard.rs index 924649e226f57..72abfc4d9dc41 100644 --- a/crates/bevy_input/src/keyboard.rs +++ b/crates/bevy_input/src/keyboard.rs @@ -20,7 +20,7 @@ use bevy_reflect::{ReflectDeserialize, ReflectSerialize}; /// ## Usage /// /// The event is consumed inside of the [`keyboard_input_system`] -/// to update the [`Input`](crate::Input) resource. +/// to update the [`Input`](Input) resource. #[derive(Event, Debug, Clone, Copy, PartialEq, Eq, Reflect)] #[reflect(Debug, PartialEq)] #[cfg_attr( diff --git a/crates/bevy_input/src/mouse.rs b/crates/bevy_input/src/mouse.rs index 8eea5141e96df..c0a63c17ae6c7 100644 --- a/crates/bevy_input/src/mouse.rs +++ b/crates/bevy_input/src/mouse.rs @@ -20,7 +20,7 @@ use bevy_reflect::{ReflectDeserialize, ReflectSerialize}; /// ## Usage /// /// The event is read inside of the [`mouse_button_input_system`] -/// to update the [`Input`](crate::Input) resource. +/// to update the [`Input`](Input) resource. #[derive(Event, Debug, Clone, Copy, PartialEq, Eq, Reflect)] #[reflect(Debug, PartialEq)] #[cfg_attr( diff --git a/crates/bevy_internal/src/lib.rs b/crates/bevy_internal/src/lib.rs index 42b368375a6e1..98dc5eeb3b126 100644 --- a/crates/bevy_internal/src/lib.rs +++ b/crates/bevy_internal/src/lib.rs @@ -138,9 +138,9 @@ pub mod pbr { #[cfg(feature = "bevy_render")] pub mod render { //! Cameras, meshes, textures, shaders, and pipelines. - //! Use [`RenderDevice::features`](crate::render::renderer::RenderDevice::features), - //! [`RenderDevice::limits`](crate::render::renderer::RenderDevice::limits), and the - //! [`RenderAdapterInfo`](crate::render::renderer::RenderAdapterInfo) resource to + //! Use [`RenderDevice::features`](renderer::RenderDevice::features), + //! [`RenderDevice::limits`](renderer::RenderDevice::limits), and the + //! [`RenderAdapterInfo`](renderer::RenderAdapterInfo) resource to //! get runtime information about the actual adapter, backend, features, and limits. pub use bevy_render::*; } diff --git a/crates/bevy_macro_utils/src/fq_std.rs b/crates/bevy_macro_utils/src/fq_std.rs index d8ed917a1500a..ecaff7088f7e9 100644 --- a/crates/bevy_macro_utils/src/fq_std.rs +++ b/crates/bevy_macro_utils/src/fq_std.rs @@ -36,21 +36,21 @@ use proc_macro2::TokenStream; use quote::{quote, ToTokens}; -/// Fully Qualified (FQ) short name for [`::core::any::Any`] +/// Fully Qualified (FQ) short name for [`core::any::Any`] pub struct FQAny; -/// Fully Qualified (FQ) short name for [`::std::boxed::Box`] +/// Fully Qualified (FQ) short name for [`Box`] pub struct FQBox; -/// Fully Qualified (FQ) short name for [`::core::clone::Clone`] +/// Fully Qualified (FQ) short name for [`Clone`] pub struct FQClone; -/// Fully Qualified (FQ) short name for [`::core::default::Default`] +/// Fully Qualified (FQ) short name for [`Default`] pub struct FQDefault; -/// Fully Qualified (FQ) short name for [`::core::option::Option`] +/// Fully Qualified (FQ) short name for [`Option`] pub struct FQOption; -/// Fully Qualified (FQ) short name for [`::core::result::Result`] +/// Fully Qualified (FQ) short name for [`Result`] pub struct FQResult; -/// Fully Qualified (FQ) short name for [`::core::marker::Send`] +/// Fully Qualified (FQ) short name for [`Send`] pub struct FQSend; -/// Fully Qualified (FQ) short name for [`::core::marker::Sync`] +/// Fully Qualified (FQ) short name for [`Sync`] pub struct FQSync; impl ToTokens for FQAny { diff --git a/crates/bevy_macro_utils/src/shape.rs b/crates/bevy_macro_utils/src/shape.rs index 30eee9a7acbe2..2d0124d62a8f9 100644 --- a/crates/bevy_macro_utils/src/shape.rs +++ b/crates/bevy_macro_utils/src/shape.rs @@ -3,7 +3,7 @@ use syn::{punctuated::Punctuated, token::Comma, Data, DataStruct, Error, Field, /// Get the fields of a data structure if that structure is a struct with named fields; /// otherwise, return a compile error that points to the site of the macro invocation. -pub fn get_struct_fields(data: &syn::Data) -> syn::Result<&Punctuated> { +pub fn get_struct_fields(data: &Data) -> syn::Result<&Punctuated> { match data { Data::Struct(DataStruct { fields: Fields::Named(fields), diff --git a/crates/bevy_pbr/src/extended_material.rs b/crates/bevy_pbr/src/extended_material.rs index 260051d05098a..dacacd5cf3edd 100644 --- a/crates/bevy_pbr/src/extended_material.rs +++ b/crates/bevy_pbr/src/extended_material.rs @@ -117,8 +117,7 @@ impl AsBindGroup for ExtendedMaterial { render_device: &RenderDevice, images: &RenderAssets, fallback_image: &FallbackImage, - ) -> Result, AsBindGroupError> - { + ) -> Result, AsBindGroupError> { // add together the bindings of the base material and the user material let UnpreparedBindGroup { mut bindings, @@ -154,42 +153,42 @@ impl AsBindGroup for ExtendedMaterial { } impl Material for ExtendedMaterial { - fn vertex_shader() -> bevy_render::render_resource::ShaderRef { + fn vertex_shader() -> ShaderRef { match E::vertex_shader() { ShaderRef::Default => B::vertex_shader(), specified => specified, } } - fn fragment_shader() -> bevy_render::render_resource::ShaderRef { + fn fragment_shader() -> ShaderRef { match E::fragment_shader() { ShaderRef::Default => B::fragment_shader(), specified => specified, } } - fn prepass_vertex_shader() -> bevy_render::render_resource::ShaderRef { + fn prepass_vertex_shader() -> ShaderRef { match E::prepass_vertex_shader() { ShaderRef::Default => B::prepass_vertex_shader(), specified => specified, } } - fn prepass_fragment_shader() -> bevy_render::render_resource::ShaderRef { + fn prepass_fragment_shader() -> ShaderRef { match E::prepass_fragment_shader() { ShaderRef::Default => B::prepass_fragment_shader(), specified => specified, } } - fn deferred_vertex_shader() -> bevy_render::render_resource::ShaderRef { + fn deferred_vertex_shader() -> ShaderRef { match E::deferred_vertex_shader() { ShaderRef::Default => B::deferred_vertex_shader(), specified => specified, } } - fn deferred_fragment_shader() -> bevy_render::render_resource::ShaderRef { + fn deferred_fragment_shader() -> ShaderRef { match E::deferred_fragment_shader() { ShaderRef::Default => B::deferred_fragment_shader(), specified => specified, diff --git a/crates/bevy_pbr/src/lib.rs b/crates/bevy_pbr/src/lib.rs index ed1d3f79dfa08..6427b99dab477 100644 --- a/crates/bevy_pbr/src/lib.rs +++ b/crates/bevy_pbr/src/lib.rs @@ -335,18 +335,15 @@ impl Plugin for PbrPlugin { // Extract the required data from the main world render_app - .add_systems( - ExtractSchedule, - (render::extract_clusters, render::extract_lights), - ) + .add_systems(ExtractSchedule, (extract_clusters, extract_lights)) .add_systems( Render, ( - render::prepare_lights + prepare_lights .in_set(RenderSet::ManageViews) .after(prepare_assets::), sort_phase_system::.in_set(RenderSet::PhaseSort), - render::prepare_clusters.in_set(RenderSet::PrepareResources), + prepare_clusters.in_set(RenderSet::PrepareResources), ), ) .init_resource::(); diff --git a/crates/bevy_pbr/src/light.rs b/crates/bevy_pbr/src/light.rs index a3c1b25441f42..2e89c10867bec 100644 --- a/crates/bevy_pbr/src/light.rs +++ b/crates/bevy_pbr/src/light.rs @@ -85,7 +85,7 @@ impl Default for PointLightShadowMap { /// A light that emits light in a given direction from a central point. /// Behaves like a point light in a perfectly absorbent housing that /// shines light only in a given direction. The direction is taken from -/// the transform, and can be specified with [`Transform::looking_at`](bevy_transform::components::Transform::looking_at). +/// the transform, and can be specified with [`Transform::looking_at`](Transform::looking_at). #[derive(Component, Debug, Clone, Copy, Reflect)] #[reflect(Component, Default)] pub struct SpotLight { @@ -172,7 +172,7 @@ impl Default for SpotLight { /// Shadows are produced via [cascaded shadow maps](https://developer.download.nvidia.com/SDK/10.5/opengl/src/cascaded_shadow_maps/doc/cascaded_shadow_maps.pdf). /// /// To modify the cascade set up, such as the number of cascades or the maximum shadow distance, -/// change the [`CascadeShadowConfig`] component of the [`crate::bundle::DirectionalLightBundle`]. +/// change the [`CascadeShadowConfig`] component of the [`DirectionalLightBundle`]. /// /// To control the resolution of the shadow maps, use the [`DirectionalLightShadowMap`] resource: /// @@ -575,11 +575,11 @@ impl Default for AmbientLight { } } -/// Add this component to make a [`Mesh`](bevy_render::mesh::Mesh) not cast shadows. +/// Add this component to make a [`Mesh`](mesh::Mesh) not cast shadows. #[derive(Component, Reflect, Default)] #[reflect(Component, Default)] pub struct NotShadowCaster; -/// Add this component to make a [`Mesh`](bevy_render::mesh::Mesh) not receive shadows. +/// Add this component to make a [`Mesh`](mesh::Mesh) not receive shadows. /// /// **Note:** If you're using diffuse transmission, setting [`NotShadowReceiver`] will /// cause both “regular” shadows as well as diffusely transmitted shadows to be disabled, @@ -587,7 +587,7 @@ pub struct NotShadowCaster; #[derive(Component, Reflect, Default)] #[reflect(Component, Default)] pub struct NotShadowReceiver; -/// Add this component to make a [`Mesh`](bevy_render::mesh::Mesh) using a PBR material with [`diffuse_transmission`](crate::pbr_material::StandardMaterial::diffuse_transmission)`> 0.0` +/// Add this component to make a [`Mesh`](mesh::Mesh) using a PBR material with [`diffuse_transmission`](crate::pbr_material::StandardMaterial::diffuse_transmission)`> 0.0` /// receive shadows on its diffuse transmission lobe. (i.e. its “backside”) /// /// Not enabled by default, as it requires carefully setting up [`thickness`](crate::pbr_material::StandardMaterial::thickness) diff --git a/crates/bevy_pbr/src/material.rs b/crates/bevy_pbr/src/material.rs index d5884bb65530c..5e972eefabe4f 100644 --- a/crates/bevy_pbr/src/material.rs +++ b/crates/bevy_pbr/src/material.rs @@ -229,7 +229,7 @@ where prepare_materials:: .in_set(RenderSet::PrepareAssets) .after(prepare_assets::), - render::queue_shadows:: + queue_shadows:: .in_set(RenderSet::QueueMeshes) .after(prepare_materials::), queue_material_meshes:: diff --git a/crates/bevy_pbr/src/pbr_material.rs b/crates/bevy_pbr/src/pbr_material.rs index 77257bc8daadb..8df280a7fa283 100644 --- a/crates/bevy_pbr/src/pbr_material.rs +++ b/crates/bevy_pbr/src/pbr_material.rs @@ -302,8 +302,8 @@ pub struct StandardMaterial { /// If your material has a normal map, but still renders as a flat surface, /// make sure your meshes have their tangents set. /// - /// [`Mesh::generate_tangents`]: bevy_render::mesh::Mesh::generate_tangents - /// [`Mesh::with_generated_tangents`]: bevy_render::mesh::Mesh::with_generated_tangents + /// [`Mesh::generate_tangents`]: mesh::Mesh::generate_tangents + /// [`Mesh::with_generated_tangents`]: mesh::Mesh::with_generated_tangents #[texture(9)] #[sampler(10)] #[dependency] @@ -352,7 +352,7 @@ pub struct StandardMaterial { /// /// Your 3D editing software should manage all of that. /// - /// [`Mesh`]: bevy_render::mesh::Mesh + /// [`Mesh`]: mesh::Mesh // TODO: include this in reflection somehow (maybe via remote types like serde https://serde.rs/remote-derive.html) #[reflect(ignore)] pub cull_mode: Option, diff --git a/crates/bevy_pbr/src/prepass/mod.rs b/crates/bevy_pbr/src/prepass/mod.rs index 67ed3b8362b13..a166de5c1509d 100644 --- a/crates/bevy_pbr/src/prepass/mod.rs +++ b/crates/bevy_pbr/src/prepass/mod.rs @@ -58,7 +58,7 @@ impl Plugin for PrepassPipelinePlugin where M::Data: PartialEq + Eq + Hash + Clone, { - fn build(&self, app: &mut bevy_app::App) { + fn build(&self, app: &mut App) { load_internal_asset!( app, PREPASS_SHADER_HANDLE, @@ -101,7 +101,7 @@ where .init_resource::(); } - fn finish(&self, app: &mut bevy_app::App) { + fn finish(&self, app: &mut App) { let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { return; }; @@ -125,7 +125,7 @@ impl Plugin for PrepassPlugin where M::Data: PartialEq + Eq + Hash + Clone, { - fn build(&self, app: &mut bevy_app::App) { + fn build(&self, app: &mut App) { let no_prepass_plugin_loaded = app.world.get_resource::().is_none(); if no_prepass_plugin_loaded { diff --git a/crates/bevy_pbr/src/render/mesh.rs b/crates/bevy_pbr/src/render/mesh.rs index e99499665645a..86b6cbb72c8db 100644 --- a/crates/bevy_pbr/src/render/mesh.rs +++ b/crates/bevy_pbr/src/render/mesh.rs @@ -75,7 +75,7 @@ pub const MORPH_HANDLE: Handle = Handle::weak_from_u128(9709828135876073 pub const MESH_PIPELINE_VIEW_LAYOUT_SAFE_MAX_TEXTURES: usize = 10; impl Plugin for MeshRenderPlugin { - fn build(&self, app: &mut bevy_app::App) { + fn build(&self, app: &mut App) { load_internal_asset!(app, FORWARD_IO_HANDLE, "forward_io.wgsl", Shader::from_wgsl); load_internal_asset!( app, @@ -151,7 +151,7 @@ impl Plugin for MeshRenderPlugin { } } - fn finish(&self, app: &mut bevy_app::App) { + fn finish(&self, app: &mut App) { let mut mesh_bindings_shader_defs = Vec::with_capacity(1); if let Ok(render_app) = app.get_sub_app_mut(RenderApp) { diff --git a/crates/bevy_reflect/bevy_reflect_derive/src/container_attributes.rs b/crates/bevy_reflect/bevy_reflect_derive/src/container_attributes.rs index a251b716a5d76..f3960df7c4bb3 100644 --- a/crates/bevy_reflect/bevy_reflect_derive/src/container_attributes.rs +++ b/crates/bevy_reflect/bevy_reflect_derive/src/container_attributes.rs @@ -446,7 +446,7 @@ fn extract_bool( mut mapper: impl FnMut(&LitBool) -> LitBool, ) -> Result { match value { - syn::Expr::Lit(syn::ExprLit { + Expr::Lit(syn::ExprLit { lit: syn::Lit::Bool(lit), .. }) => Ok(mapper(lit)), diff --git a/crates/bevy_reflect/bevy_reflect_derive/src/derive_data.rs b/crates/bevy_reflect/bevy_reflect_derive/src/derive_data.rs index 59b3e2dd08a30..e013e68b77849 100644 --- a/crates/bevy_reflect/bevy_reflect_derive/src/derive_data.rs +++ b/crates/bevy_reflect/bevy_reflect_derive/src/derive_data.rs @@ -444,7 +444,7 @@ impl<'a> ReflectStruct<'a> { /// Returns the `GetTypeRegistration` impl as a `TokenStream`. /// - /// Returns a specific implementation for structs and this method should be preferred over the generic [`get_type_registration`](crate::ReflectMeta) method + /// Returns a specific implementation for structs and this method should be preferred over the generic [`get_type_registration`](ReflectMeta) method pub fn get_type_registration( &self, where_clause_options: &WhereClauseOptions, @@ -457,7 +457,7 @@ impl<'a> ReflectStruct<'a> { } /// Get a collection of types which are exposed to the reflection API - pub fn active_types(&self) -> Vec { + pub fn active_types(&self) -> Vec { self.active_fields() .map(|field| field.data.ty.clone()) .collect() @@ -605,14 +605,14 @@ pub(crate) enum ReflectTypePath<'a> { /// /// May have a separate alias path used for the `TypePath` implementation. /// - /// Module and crate are found with [`module_path!()`](core::module_path), + /// Module and crate are found with [`module_path!()`](module_path), /// if there is no custom path specified. Internal { ident: &'a Ident, custom_path: Option, generics: &'a Generics, }, - /// Any [`syn::Type`] with only a defined `type_path` and `short_type_path`. + /// Any [`Type`] with only a defined `type_path` and `short_type_path`. #[allow(dead_code)] // Not currently used but may be useful in the future due to its generality. Anonymous { diff --git a/crates/bevy_reflect/bevy_reflect_derive/src/impls/structs.rs b/crates/bevy_reflect/bevy_reflect_derive/src/impls/structs.rs index 1bf46968cebdc..fb1565f0012d4 100644 --- a/crates/bevy_reflect/bevy_reflect_derive/src/impls/structs.rs +++ b/crates/bevy_reflect/bevy_reflect_derive/src/impls/structs.rs @@ -50,7 +50,7 @@ pub(crate) fn impl_struct(reflect_struct: &ReflectStruct) -> proc_macro2::TokenS let field_generator = { let docs = reflect_struct .active_fields() - .map(|field| quote::ToTokens::to_token_stream(&field.doc)); + .map(|field| ToTokens::to_token_stream(&field.doc)); quote! { #(#bevy_reflect_path::NamedField::new::<#field_types>(#field_names).with_docs(#docs) ,)* } diff --git a/crates/bevy_reflect/bevy_reflect_derive/src/impls/tuple_structs.rs b/crates/bevy_reflect/bevy_reflect_derive/src/impls/tuple_structs.rs index e05226d7a52b6..7a097a1a1a465 100644 --- a/crates/bevy_reflect/bevy_reflect_derive/src/impls/tuple_structs.rs +++ b/crates/bevy_reflect/bevy_reflect_derive/src/impls/tuple_structs.rs @@ -44,7 +44,7 @@ pub(crate) fn impl_tuple_struct(reflect_struct: &ReflectStruct) -> proc_macro2:: let field_generator = { let docs = reflect_struct .active_fields() - .map(|field| quote::ToTokens::to_token_stream(&field.doc)); + .map(|field| ToTokens::to_token_stream(&field.doc)); quote! { #(#bevy_reflect_path::UnnamedField::new::<#field_types>(#field_idents).with_docs(#docs) ,)* } diff --git a/crates/bevy_reflect/src/array.rs b/crates/bevy_reflect/src/array.rs index befb87c6d78e2..760edc3f910c6 100644 --- a/crates/bevy_reflect/src/array.rs +++ b/crates/bevy_reflect/src/array.rs @@ -380,7 +380,7 @@ impl<'a> ExactSizeIterator for ArrayIter<'a> {} #[inline] pub fn array_hash(array: &A) -> Option { let mut hasher = reflect_hasher(); - std::any::Any::type_id(array).hash(&mut hasher); + Any::type_id(array).hash(&mut hasher); array.len().hash(&mut hasher); for value in array.iter() { hasher.write_u64(value.reflect_hash()?); diff --git a/crates/bevy_reflect/src/enums/enum_trait.rs b/crates/bevy_reflect/src/enums/enum_trait.rs index 09158754ae029..e6cb09e83ab9c 100644 --- a/crates/bevy_reflect/src/enums/enum_trait.rs +++ b/crates/bevy_reflect/src/enums/enum_trait.rs @@ -84,8 +84,8 @@ use std::slice::Iter; /// /// [enum-like]: https://doc.rust-lang.org/book/ch06-01-defining-an-enum.html /// [reflection]: crate -/// [`None`]: core::option::Option::None -/// [`Some`]: core::option::Option::Some +/// [`None`]: Option::None +/// [`Some`]: Option::Some /// [`Reflect`]: bevy_reflect_derive::Reflect pub trait Enum: Reflect { /// Returns a reference to the value of the field (in the current variant) with the given name. diff --git a/crates/bevy_reflect/src/impls/std.rs b/crates/bevy_reflect/src/impls/std.rs index c3cc07432cd83..4fd1043e31eed 100644 --- a/crates/bevy_reflect/src/impls/std.rs +++ b/crates/bevy_reflect/src/impls/std.rs @@ -1166,8 +1166,8 @@ impl List for Cow<'static, [T]> { self.as_ref().len() } - fn iter(&self) -> crate::ListIter { - crate::ListIter::new(self) + fn iter(&self) -> ListIter { + ListIter::new(self) } fn drain(self: Box) -> Vec> { @@ -1474,7 +1474,7 @@ impl Reflect for Cow<'static, Path> { } } - fn debug(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + fn debug(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Debug::fmt(&self, f) } } diff --git a/crates/bevy_reflect/src/lib.rs b/crates/bevy_reflect/src/lib.rs index f7cc072057737..733d9acd584cf 100644 --- a/crates/bevy_reflect/src/lib.rs +++ b/crates/bevy_reflect/src/lib.rs @@ -1281,11 +1281,11 @@ mod tests { // TypeInfo let info = i32::type_info(); assert_eq!(i32::type_path(), info.type_path()); - assert_eq!(std::any::TypeId::of::(), info.type_id()); + assert_eq!(TypeId::of::(), info.type_id()); // TypeInfo (unsized) assert_eq!( - std::any::TypeId::of::(), + TypeId::of::(), ::type_info().type_id() ); @@ -1306,10 +1306,7 @@ mod tests { assert!(info.is::()); assert_eq!(MyStruct::type_path(), info.type_path()); assert_eq!(i32::type_path(), info.field("foo").unwrap().type_path()); - assert_eq!( - std::any::TypeId::of::(), - info.field("foo").unwrap().type_id() - ); + assert_eq!(TypeId::of::(), info.field("foo").unwrap().type_id()); assert!(info.field("foo").unwrap().is::()); assert_eq!("foo", info.field("foo").unwrap().name()); assert_eq!(usize::type_path(), info.field_at(1).unwrap().type_path()); @@ -1990,7 +1987,7 @@ bevy_reflect::tests::Test { let de = UntypedReflectDeserializer::new(®istry); let mut deserializer = - ron::de::Deserializer::from_str(data).expect("Failed to acquire deserializer"); + Deserializer::from_str(data).expect("Failed to acquire deserializer"); let dynamic_struct = de .deserialize(&mut deserializer) @@ -2047,7 +2044,7 @@ bevy_reflect::tests::Test { let de = UntypedReflectDeserializer::new(®istry); let mut deserializer = - ron::de::Deserializer::from_str(data).expect("Failed to acquire deserializer"); + Deserializer::from_str(data).expect("Failed to acquire deserializer"); let dynamic_struct = de .deserialize(&mut deserializer) diff --git a/crates/bevy_reflect/src/list.rs b/crates/bevy_reflect/src/list.rs index ed129b803be3b..54d69e453ab36 100644 --- a/crates/bevy_reflect/src/list.rs +++ b/crates/bevy_reflect/src/list.rs @@ -46,7 +46,7 @@ use crate::{ /// /// [list-like]: https://doc.rust-lang.org/book/ch08-01-vectors.html /// [reflection]: crate -/// [`Vec`]: std::vec::Vec +/// [`Vec`]: Vec /// [type-erasing]: https://doc.rust-lang.org/book/ch17-02-trait-objects.html pub trait List: Reflect { /// Returns a reference to the element at `index`, or `None` if out of bounds. @@ -414,7 +414,7 @@ impl<'a> ExactSizeIterator for ListIter<'a> {} #[inline] pub fn list_hash(list: &L) -> Option { let mut hasher = reflect_hasher(); - std::any::Any::type_id(list).hash(&mut hasher); + Any::type_id(list).hash(&mut hasher); list.len().hash(&mut hasher); for value in list.iter() { hasher.write_u64(value.reflect_hash()?); @@ -493,7 +493,7 @@ pub fn list_partial_eq(a: &L, b: &dyn Reflect) -> Option { /// // ] /// ``` #[inline] -pub fn list_debug(dyn_list: &dyn List, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +pub fn list_debug(dyn_list: &dyn List, f: &mut Formatter<'_>) -> std::fmt::Result { let mut debug = f.debug_list(); for item in dyn_list.iter() { debug.entry(&item as &dyn Debug); diff --git a/crates/bevy_reflect/src/map.rs b/crates/bevy_reflect/src/map.rs index 5ed7f72870561..f2d9adbf5b12e 100644 --- a/crates/bevy_reflect/src/map.rs +++ b/crates/bevy_reflect/src/map.rs @@ -41,7 +41,7 @@ use crate::{ /// /// [map-like]: https://doc.rust-lang.org/book/ch08-03-hash-maps.html /// [reflection]: crate -/// [`HashMap`]: bevy_utils::HashMap +/// [`HashMap`]: HashMap pub trait Map: Reflect { /// Returns a reference to the value associated with the given key. /// @@ -486,7 +486,7 @@ pub fn map_partial_eq(a: &M, b: &dyn Reflect) -> Option { /// // } /// ``` #[inline] -pub fn map_debug(dyn_map: &dyn Map, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +pub fn map_debug(dyn_map: &dyn Map, f: &mut Formatter<'_>) -> std::fmt::Result { let mut debug = f.debug_map(); for (key, value) in dyn_map.iter() { debug.entry(&key as &dyn Debug, &value as &dyn Debug); diff --git a/crates/bevy_reflect/src/serde/de.rs b/crates/bevy_reflect/src/serde/de.rs index 170c6c941cf1f..392ff6c33dd77 100644 --- a/crates/bevy_reflect/src/serde/de.rs +++ b/crates/bevy_reflect/src/serde/de.rs @@ -7,8 +7,7 @@ use crate::{ }; use erased_serde::Deserializer; use serde::de::{ - self, DeserializeSeed, EnumAccess, Error, IgnoredAny, MapAccess, SeqAccess, VariantAccess, - Visitor, + DeserializeSeed, EnumAccess, Error, IgnoredAny, MapAccess, SeqAccess, VariantAccess, Visitor, }; use serde::Deserialize; use std::any::TypeId; @@ -74,7 +73,7 @@ impl Container for StructInfo { registry: &'a TypeRegistry, ) -> Result<&'a TypeRegistration, E> { let field = self.field_at(index).ok_or_else(|| { - de::Error::custom(format_args!( + Error::custom(format_args!( "no field at index {} on struct {}", index, self.type_path(), @@ -113,7 +112,7 @@ impl Container for StructVariantInfo { registry: &'a TypeRegistry, ) -> Result<&'a TypeRegistration, E> { let field = self.field_at(index).ok_or_else(|| { - de::Error::custom(format_args!( + Error::custom(format_args!( "no field at index {} on variant {}", index, self.name(), @@ -144,7 +143,7 @@ impl Container for TupleInfo { registry: &'a TypeRegistry, ) -> Result<&'a TypeRegistration, E> { let field = self.field_at(index).ok_or_else(|| { - de::Error::custom(format_args!( + Error::custom(format_args!( "no field at index {} on tuple {}", index, self.type_path(), @@ -175,7 +174,7 @@ impl Container for TupleStructInfo { registry: &'a TypeRegistry, ) -> Result<&'a TypeRegistration, E> { let field = self.field_at(index).ok_or_else(|| { - de::Error::custom(format_args!( + Error::custom(format_args!( "no field at index {} on tuple struct {}", index, self.type_path(), @@ -206,7 +205,7 @@ impl Container for TupleVariantInfo { registry: &'a TypeRegistry, ) -> Result<&'a TypeRegistration, E> { let field = self.field_at(index).ok_or_else(|| { - de::Error::custom(format_args!( + Error::custom(format_args!( "no field at index {} on tuple variant {}", index, self.name(), @@ -253,7 +252,7 @@ impl<'de> Deserialize<'de> for Ident { impl<'de> Visitor<'de> for IdentVisitor { type Value = Ident; - fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + fn expecting(&self, formatter: &mut Formatter) -> fmt::Result { formatter.write_str("identifier") } @@ -281,7 +280,7 @@ struct U32Visitor; impl<'de> Visitor<'de> for U32Visitor { type Value = u32; - fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + fn expecting(&self, formatter: &mut Formatter) -> fmt::Result { formatter.write_str("u32") } @@ -313,8 +312,8 @@ impl<'de> Visitor<'de> for U32Visitor { /// [`TypedReflectDeserializer`] may be used instead to avoid requiring these entries. /// /// [`Box`]: crate::Reflect -/// [`DynamicStruct`]: crate::DynamicStruct -/// [`DynamicList`]: crate::DynamicList +/// [`DynamicStruct`]: DynamicStruct +/// [`DynamicList`]: DynamicList /// [`FromReflect`]: crate::FromReflect /// [type path]: crate::TypePath::type_path pub struct UntypedReflectDeserializer<'a> { @@ -346,7 +345,7 @@ impl<'a, 'de> DeserializeSeed<'de> for UntypedReflectDeserializer<'a> { /// This deserializer expects a string containing the _full_ [type path] of the /// type to find the `TypeRegistration` of. /// -/// [`&TypeRegistration`]: crate::TypeRegistration +/// [`&TypeRegistration`]: TypeRegistration /// [type path]: crate::TypePath::type_path pub struct TypeRegistrationDeserializer<'a> { registry: &'a TypeRegistry, @@ -370,7 +369,7 @@ impl<'a, 'de> DeserializeSeed<'de> for TypeRegistrationDeserializer<'a> { impl<'de, 'a> Visitor<'de> for TypeRegistrationVisitor<'a> { type Value = &'a TypeRegistration; - fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + fn expecting(&self, formatter: &mut Formatter) -> fmt::Result { formatter.write_str("string containing `type` entry for the reflected value") } @@ -395,7 +394,7 @@ struct UntypedReflectDeserializerVisitor<'a> { impl<'a, 'de> Visitor<'de> for UntypedReflectDeserializerVisitor<'a> { type Value = Box; - fn expecting(&self, formatter: &mut Formatter) -> std::fmt::Result { + fn expecting(&self, formatter: &mut Formatter) -> fmt::Result { formatter.write_str("map containing `type` and `value` entries for the reflected value") } @@ -433,10 +432,10 @@ impl<'a, 'de> Visitor<'de> for UntypedReflectDeserializerVisitor<'a> { /// /// If the type is not known ahead of time, use [`UntypedReflectDeserializer`] instead. /// -/// [`TypeInfo`]: crate::TypeInfo +/// [`TypeInfo`]: TypeInfo /// [`Box`]: crate::Reflect -/// [`DynamicStruct`]: crate::DynamicStruct -/// [`DynamicList`]: crate::DynamicList +/// [`DynamicStruct`]: DynamicStruct +/// [`DynamicList`]: DynamicList /// [`FromReflect`]: crate::FromReflect pub struct TypedReflectDeserializer<'a> { registration: &'a TypeRegistration, @@ -558,7 +557,7 @@ impl<'a, 'de> DeserializeSeed<'de> for TypedReflectDeserializer<'a> { } TypeInfo::Value(_) => { // This case should already be handled - Err(de::Error::custom(format_args!( + Err(Error::custom(format_args!( "the TypeRegistration for {type_path} doesn't have ReflectDeserialize", ))) } @@ -575,7 +574,7 @@ struct StructVisitor<'a> { impl<'a, 'de> Visitor<'de> for StructVisitor<'a> { type Value = DynamicStruct; - fn expecting(&self, formatter: &mut Formatter) -> std::fmt::Result { + fn expecting(&self, formatter: &mut Formatter) -> fmt::Result { formatter.write_str("reflected struct value") } @@ -603,7 +602,7 @@ struct TupleStructVisitor<'a> { impl<'a, 'de> Visitor<'de> for TupleStructVisitor<'a> { type Value = DynamicTupleStruct; - fn expecting(&self, formatter: &mut Formatter) -> std::fmt::Result { + fn expecting(&self, formatter: &mut Formatter) -> fmt::Result { formatter.write_str("reflected tuple struct value") } @@ -630,7 +629,7 @@ struct TupleVisitor<'a> { impl<'a, 'de> Visitor<'de> for TupleVisitor<'a> { type Value = DynamicTuple; - fn expecting(&self, formatter: &mut Formatter) -> std::fmt::Result { + fn expecting(&self, formatter: &mut Formatter) -> fmt::Result { formatter.write_str("reflected tuple value") } @@ -650,7 +649,7 @@ struct ArrayVisitor<'a> { impl<'a, 'de> Visitor<'de> for ArrayVisitor<'a> { type Value = DynamicArray; - fn expecting(&self, formatter: &mut Formatter) -> std::fmt::Result { + fn expecting(&self, formatter: &mut Formatter) -> fmt::Result { formatter.write_str("reflected array value") } @@ -690,7 +689,7 @@ struct ListVisitor<'a> { impl<'a, 'de> Visitor<'de> for ListVisitor<'a> { type Value = DynamicList; - fn expecting(&self, formatter: &mut Formatter) -> std::fmt::Result { + fn expecting(&self, formatter: &mut Formatter) -> fmt::Result { formatter.write_str("reflected list value") } @@ -722,7 +721,7 @@ struct MapVisitor<'a> { impl<'a, 'de> Visitor<'de> for MapVisitor<'a> { type Value = DynamicMap; - fn expecting(&self, formatter: &mut Formatter) -> std::fmt::Result { + fn expecting(&self, formatter: &mut Formatter) -> fmt::Result { formatter.write_str("reflected map value") } @@ -765,7 +764,7 @@ struct EnumVisitor<'a> { impl<'a, 'de> Visitor<'de> for EnumVisitor<'a> { type Value = DynamicEnum; - fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { + fn expecting(&self, formatter: &mut Formatter) -> fmt::Result { formatter.write_str("reflected enum value") } @@ -878,7 +877,7 @@ struct StructVariantVisitor<'a> { impl<'a, 'de> Visitor<'de> for StructVariantVisitor<'a> { type Value = DynamicStruct; - fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { + fn expecting(&self, formatter: &mut Formatter) -> fmt::Result { formatter.write_str("reflected struct variant value") } @@ -906,7 +905,7 @@ struct TupleVariantVisitor<'a> { impl<'a, 'de> Visitor<'de> for TupleVariantVisitor<'a> { type Value = DynamicTuple; - fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { + fn expecting(&self, formatter: &mut Formatter) -> fmt::Result { formatter.write_str("reflected tuple variant value") } diff --git a/crates/bevy_reflect/src/serde/ser.rs b/crates/bevy_reflect/src/serde/ser.rs index d276605d23c3d..35c5107cf5082 100644 --- a/crates/bevy_reflect/src/serde/ser.rs +++ b/crates/bevy_reflect/src/serde/ser.rs @@ -28,14 +28,14 @@ impl<'a> Serializable<'a> { } } -fn get_serializable<'a, E: serde::ser::Error>( +fn get_serializable<'a, E: Error>( reflect_value: &'a dyn Reflect, type_registry: &TypeRegistry, ) -> Result, E> { let reflect_serialize = type_registry .get_type_data::(reflect_value.type_id()) .ok_or_else(|| { - serde::ser::Error::custom(format_args!( + Error::custom(format_args!( "Type '{}' did not register ReflectSerialize", reflect_value.reflect_type_path() )) diff --git a/crates/bevy_reflect/src/struct_trait.rs b/crates/bevy_reflect/src/struct_trait.rs index 9ecf2784abb0c..512aeae3ecab7 100644 --- a/crates/bevy_reflect/src/struct_trait.rs +++ b/crates/bevy_reflect/src/struct_trait.rs @@ -542,7 +542,7 @@ pub fn struct_partial_eq(a: &S, b: &dyn Reflect) -> Option { /// // } /// ``` #[inline] -pub fn struct_debug(dyn_struct: &dyn Struct, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +pub fn struct_debug(dyn_struct: &dyn Struct, f: &mut Formatter<'_>) -> std::fmt::Result { let mut debug = f.debug_struct(dyn_struct.reflect_type_path()); for field_index in 0..dyn_struct.field_len() { let field = dyn_struct.field_at(field_index).unwrap(); diff --git a/crates/bevy_reflect/src/tuple.rs b/crates/bevy_reflect/src/tuple.rs index 87ad68c59f0ff..747fb29e391ad 100644 --- a/crates/bevy_reflect/src/tuple.rs +++ b/crates/bevy_reflect/src/tuple.rs @@ -446,7 +446,7 @@ pub fn tuple_partial_eq(a: &T, b: &dyn Reflect) -> Option { /// // ) /// ``` #[inline] -pub fn tuple_debug(dyn_tuple: &dyn Tuple, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +pub fn tuple_debug(dyn_tuple: &dyn Tuple, f: &mut Formatter<'_>) -> std::fmt::Result { let mut debug = f.debug_tuple(""); for field in dyn_tuple.iter_fields() { debug.field(&field as &dyn Debug); diff --git a/crates/bevy_reflect/src/tuple_struct.rs b/crates/bevy_reflect/src/tuple_struct.rs index ff9c53d5481aa..c2e66eafff378 100644 --- a/crates/bevy_reflect/src/tuple_struct.rs +++ b/crates/bevy_reflect/src/tuple_struct.rs @@ -451,7 +451,7 @@ pub fn tuple_struct_partial_eq(a: &S, b: &dyn Reflect) -> Option #[inline] pub fn tuple_struct_debug( dyn_tuple_struct: &dyn TupleStruct, - f: &mut std::fmt::Formatter<'_>, + f: &mut Formatter<'_>, ) -> std::fmt::Result { let mut debug = f.debug_tuple(dyn_tuple_struct.reflect_type_path()); for field in dyn_tuple_struct.iter_fields() { diff --git a/crates/bevy_reflect/src/type_info.rs b/crates/bevy_reflect/src/type_info.rs index 8d677c908c9a8..0e655adef1c8a 100644 --- a/crates/bevy_reflect/src/type_info.rs +++ b/crates/bevy_reflect/src/type_info.rs @@ -95,9 +95,9 @@ pub trait Typed: Reflect + TypePath { /// it can be more performant. This is because those other methods may require attaining a lock on /// the static [`TypeInfo`], while the registry simply checks a map. /// -/// [`Reflect::get_represented_type_info`]: crate::Reflect::get_represented_type_info +/// [`Reflect::get_represented_type_info`]: Reflect::get_represented_type_info /// [`TypeRegistry::get_type_info`]: crate::TypeRegistry::get_type_info -/// [`TypeId`]: std::any::TypeId +/// [`TypeId`]: TypeId /// [type path]: TypePath::type_path #[derive(Debug, Clone)] pub enum TypeInfo { diff --git a/crates/bevy_reflect/src/type_registry.rs b/crates/bevy_reflect/src/type_registry.rs index 00843daebb8f4..0f271eba3e526 100644 --- a/crates/bevy_reflect/src/type_registry.rs +++ b/crates/bevy_reflect/src/type_registry.rs @@ -167,7 +167,7 @@ impl TypeRegistry { /// /// If the specified type has not been registered, returns `None`. /// - /// [`TypeId`]: std::any::TypeId + /// [`TypeId`]: TypeId pub fn get(&self, type_id: TypeId) -> Option<&TypeRegistration> { self.registrations.get(&type_id) } @@ -177,7 +177,7 @@ impl TypeRegistry { /// /// If the specified type has not been registered, returns `None`. /// - /// [`TypeId`]: std::any::TypeId + /// [`TypeId`]: TypeId pub fn get_mut(&mut self, type_id: TypeId) -> Option<&mut TypeRegistration> { self.registrations.get_mut(&type_id) } @@ -335,7 +335,7 @@ impl Debug for TypeRegistration { impl TypeRegistration { /// Returns the [`TypeId`] of the type. /// - /// [`TypeId`]: std::any::TypeId + /// [`TypeId`]: TypeId #[inline] pub fn type_id(&self) -> TypeId { self.type_info.type_id() @@ -582,7 +582,7 @@ impl ReflectFromPtr { impl FromType for ReflectFromPtr { fn from_type() -> Self { ReflectFromPtr { - type_id: std::any::TypeId::of::(), + type_id: TypeId::of::(), from_ptr: |ptr| { // SAFETY: `from_ptr_mut` is either called in `ReflectFromPtr::as_reflect` // or returned by `ReflectFromPtr::from_ptr`, both lay out the invariants diff --git a/crates/bevy_render/src/camera/camera.rs b/crates/bevy_render/src/camera/camera.rs index 14f9ae72511fa..27ce9db052e13 100644 --- a/crates/bevy_render/src/camera/camera.rs +++ b/crates/bevy_render/src/camera/camera.rs @@ -368,7 +368,7 @@ pub enum CameraOutputMode { blend_state: Option, /// The color attachment load operation that will be used by the pipeline that writes the intermediate render textures to the final render /// target texture. - color_attachment_load_op: wgpu::LoadOp, + color_attachment_load_op: LoadOp, }, /// Skips writing the camera output to the configured render target. The output will remain in the /// Render Target's "intermediate" textures, which a camera with a higher order should write to the render target @@ -562,7 +562,7 @@ impl NormalizedRenderTarget { /// /// [`OrthographicProjection`]: crate::camera::OrthographicProjection /// [`PerspectiveProjection`]: crate::camera::PerspectiveProjection -/// [`Projection`]: crate::camera::Projection +/// [`Projection`]: Projection #[allow(clippy::too_many_arguments)] pub fn camera_system( mut window_resized_events: EventReader, diff --git a/crates/bevy_render/src/lib.rs b/crates/bevy_render/src/lib.rs index 9e560f22ad855..3de2e7467296f 100644 --- a/crates/bevy_render/src/lib.rs +++ b/crates/bevy_render/src/lib.rs @@ -87,7 +87,7 @@ pub enum RenderSet { ManageViews, /// The copy of [`apply_deferred`] that runs immediately after [`ManageViews`](RenderSet::ManageViews). ManageViewsFlush, - /// Queue drawable entities as phase items in [`RenderPhase`](crate::render_phase::RenderPhase)s + /// Queue drawable entities as phase items in [`RenderPhase`](render_phase::RenderPhase)s /// ready for sorting Queue, /// A sub-set within [`Queue`](RenderSet::Queue) where mesh entity queue systems are executed. Ensures `prepare_assets::` is completed. @@ -96,7 +96,7 @@ pub enum RenderSet { /// Sort the [`RenderPhases`](render_phase::RenderPhase) here. PhaseSort, /// Prepare render resources from extracted data for the GPU based on their sorted order. - /// Create [`BindGroups`](crate::render_resource::BindGroup) that depend on those data. + /// Create [`BindGroups`](render_resource::BindGroup) that depend on those data. Prepare, /// A sub-set within [`Prepare`](RenderSet::Prepare) for initializing buffers, textures and uniforms for use in bind groups. PrepareResources, @@ -158,11 +158,7 @@ impl Render { ); schedule.configure_sets((ExtractCommands, PrepareAssets, Prepare).chain()); - schedule.configure_sets( - QueueMeshes - .in_set(RenderSet::Queue) - .after(prepare_assets::), - ); + schedule.configure_sets(QueueMeshes.in_set(Queue).after(prepare_assets::)); schedule.configure_sets( (PrepareResources, PrepareResourcesFlush, PrepareBindGroups) .chain() @@ -179,7 +175,7 @@ impl Render { /// running the next frame while rendering the current frame. /// /// This schedule is run on the main world, but its buffers are not applied -/// via [`Schedule::apply_deferred`](bevy_ecs::schedule::Schedule) until it is returned to the render world. +/// via [`Schedule::apply_deferred`](Schedule) until it is returned to the render world. #[derive(ScheduleLabel, PartialEq, Eq, Debug, Clone, Hash)] pub struct ExtractSchedule; diff --git a/crates/bevy_render/src/mesh/mesh/mod.rs b/crates/bevy_render/src/mesh/mesh/mod.rs index 1a348702af39f..12713ce23b3d8 100644 --- a/crates/bevy_render/src/mesh/mesh/mod.rs +++ b/crates/bevy_render/src/mesh/mesh/mod.rs @@ -31,7 +31,7 @@ pub const VERTEX_ATTRIBUTE_BUFFER_ID: u64 = 10; /// with "attribute" values for each vertex. /// /// Meshes can be automatically generated by a bevy `AssetLoader` (generally by loading a `Gltf` file), -/// or by converting a primitive [`shape`](crate::mesh::shape) using [`into`](std::convert::Into). +/// or by converting a primitive [`shape`](crate::mesh::shape) using [`into`](Into). /// It is also possible to create one manually. /// They can be edited after creation. /// @@ -756,7 +756,7 @@ pub trait VertexFormatSize { fn get_size(self) -> u64; } -impl VertexFormatSize for wgpu::VertexFormat { +impl VertexFormatSize for VertexFormat { #[allow(clippy::match_same_arms)] fn get_size(self) -> u64 { match self { @@ -1151,7 +1151,7 @@ impl bevy_mikktspace::Geometry for MikktspaceGeometryHelper<'_> { } } -#[derive(thiserror::Error, Debug)] +#[derive(Error, Debug)] /// Failed to generate tangents for the mesh. pub enum GenerateTangentsError { #[error("cannot generate tangents for {0:?}")] diff --git a/crates/bevy_render/src/pipelined_rendering.rs b/crates/bevy_render/src/pipelined_rendering.rs index f8fcfe53e978e..adde2259a873b 100644 --- a/crates/bevy_render/src/pipelined_rendering.rs +++ b/crates/bevy_render/src/pipelined_rendering.rs @@ -37,7 +37,7 @@ pub struct RenderToMainAppReceiver(pub Receiver); /// |--------------------|--------------------|--------------------|--------------------| /// ``` /// -/// The plugin is dependent on the [`crate::RenderApp`] added by [`crate::RenderPlugin`] and so must +/// The plugin is dependent on the [`RenderApp`] added by [`crate::RenderPlugin`] and so must /// be added after that plugin. If it is not added after, the plugin will do nothing. /// /// A single frame of execution looks something like below diff --git a/crates/bevy_render/src/render_resource/batched_uniform_buffer.rs b/crates/bevy_render/src/render_resource/batched_uniform_buffer.rs index 08c29a8664856..9f317d86ef0bf 100644 --- a/crates/bevy_render/src/render_resource/batched_uniform_buffer.rs +++ b/crates/bevy_render/src/render_resource/batched_uniform_buffer.rs @@ -137,7 +137,7 @@ where const METADATA: Metadata = T::METADATA; - fn size(&self) -> ::core::num::NonZeroU64 { + fn size(&self) -> NonZeroU64 { Self::METADATA.stride().mul(self.1.max(1) as u64).0 } } diff --git a/crates/bevy_render/src/render_resource/bind_group.rs b/crates/bevy_render/src/render_resource/bind_group.rs index 22ab55fd1292f..92db7853cadf7 100644 --- a/crates/bevy_render/src/render_resource/bind_group.rs +++ b/crates/bevy_render/src/render_resource/bind_group.rs @@ -20,7 +20,7 @@ render_resource_wrapper!(ErasedBindGroup, wgpu::BindGroup); /// This makes them accessible in the pipeline (shaders) as uniforms. /// /// May be converted from and dereferences to a wgpu [`BindGroup`](wgpu::BindGroup). -/// Can be created via [`RenderDevice::create_bind_group`](crate::renderer::RenderDevice::create_bind_group). +/// Can be created via [`RenderDevice::create_bind_group`](RenderDevice::create_bind_group). #[derive(Clone, Debug)] pub struct BindGroup { id: BindGroupId, diff --git a/crates/bevy_render/src/render_resource/bind_group_layout_entries.rs b/crates/bevy_render/src/render_resource/bind_group_layout_entries.rs index ad251696571bf..1cd7869f92ab7 100644 --- a/crates/bevy_render/src/render_resource/bind_group_layout_entries.rs +++ b/crates/bevy_render/src/render_resource/bind_group_layout_entries.rs @@ -144,12 +144,8 @@ impl BindGroupLayoutEntryBuilder { self } - pub fn build( - &self, - binding: u32, - default_visibility: ShaderStages, - ) -> wgpu::BindGroupLayoutEntry { - wgpu::BindGroupLayoutEntry { + pub fn build(&self, binding: u32, default_visibility: ShaderStages) -> BindGroupLayoutEntry { + BindGroupLayoutEntry { binding, ty: self.ty, visibility: self.visibility.unwrap_or(default_visibility), @@ -159,7 +155,7 @@ impl BindGroupLayoutEntryBuilder { } pub struct BindGroupLayoutEntries { - entries: [wgpu::BindGroupLayoutEntry; N], + entries: [BindGroupLayoutEntry; N], } impl BindGroupLayoutEntries { @@ -203,8 +199,8 @@ impl BindGroupLayoutEntries<1> { } impl std::ops::Deref for BindGroupLayoutEntries { - type Target = [wgpu::BindGroupLayoutEntry]; - fn deref(&self) -> &[wgpu::BindGroupLayoutEntry] { + type Target = [BindGroupLayoutEntry]; + fn deref(&self) -> &[BindGroupLayoutEntry] { &self.entries } } @@ -223,7 +219,7 @@ impl IntoBindGroupLayoutEntryBuilder for BindingType { } } -impl IntoBindGroupLayoutEntryBuilder for wgpu::BindGroupLayoutEntry { +impl IntoBindGroupLayoutEntryBuilder for BindGroupLayoutEntry { fn into_bind_group_layout_entry_builder(self) -> BindGroupLayoutEntryBuilder { if self.binding != u32::MAX { bevy_log::warn!("The BindGroupLayoutEntries api ignores the binding index when converting a raw wgpu::BindGroupLayoutEntry. You can ignore this warning by setting it to u32::MAX."); diff --git a/crates/bevy_render/src/render_resource/buffer_vec.rs b/crates/bevy_render/src/render_resource/buffer_vec.rs index d248470b6d6fa..cae1ef4f05381 100644 --- a/crates/bevy_render/src/render_resource/buffer_vec.rs +++ b/crates/bevy_render/src/render_resource/buffer_vec.rs @@ -15,9 +15,9 @@ use wgpu::BufferUsages; /// Index, vertex, and instance-rate vertex buffers have no alignment nor padding requirements and /// so this helper type is a good choice for them. /// -/// The contained data is stored in system RAM. Calling [`reserve`](crate::render_resource::BufferVec::reserve) +/// The contained data is stored in system RAM. Calling [`reserve`](BufferVec::reserve) /// allocates VRAM from the [`RenderDevice`]. -/// [`write_buffer`](crate::render_resource::BufferVec::write_buffer) queues copying of the data +/// [`write_buffer`](BufferVec::write_buffer) queues copying of the data /// from system RAM to VRAM. /// /// Other options for storing GPU-accessible data are: @@ -105,7 +105,7 @@ impl BufferVec { /// /// In addition to any [`BufferUsages`] provided when /// the `BufferVec` was created, the buffer on the [`RenderDevice`] - /// is marked as [`BufferUsages::COPY_DST`](crate::render_resource::BufferUsages). + /// is marked as [`BufferUsages::COPY_DST`](BufferUsages). pub fn reserve(&mut self, capacity: usize, device: &RenderDevice) { if capacity > self.capacity || self.label_changed { self.capacity = capacity; @@ -123,7 +123,7 @@ impl BufferVec { /// Queues writing of data from system RAM to VRAM using the [`RenderDevice`] /// and the provided [`RenderQueue`]. /// - /// Before queuing the write, a [`reserve`](crate::render_resource::BufferVec::reserve) operation + /// Before queuing the write, a [`reserve`](BufferVec::reserve) operation /// is executed. pub fn write_buffer(&mut self, device: &RenderDevice, queue: &RenderQueue) { if self.values.is_empty() { diff --git a/crates/bevy_render/src/render_resource/storage_buffer.rs b/crates/bevy_render/src/render_resource/storage_buffer.rs index 78f655998fef0..418e35cfbca8b 100644 --- a/crates/bevy_render/src/render_resource/storage_buffer.rs +++ b/crates/bevy_render/src/render_resource/storage_buffer.rs @@ -15,7 +15,7 @@ use wgpu::{util::BufferInitDescriptor, BindingResource, BufferBinding, BufferUsa /// /// Storage buffers can store runtime-sized arrays, but only if they are the last field in a structure. /// -/// The contained data is stored in system RAM. [`write_buffer`](crate::render_resource::StorageBuffer::write_buffer) queues +/// The contained data is stored in system RAM. [`write_buffer`](StorageBuffer::write_buffer) queues /// copying of the data from system RAM to VRAM. Storage buffers must conform to [std430 alignment/padding requirements], which /// is automatically enforced by this structure. /// @@ -141,12 +141,12 @@ impl StorageBuffer { /// Dynamic storage buffers can be made available to shaders in some combination of read/write mode, and can store large amounts /// of data. Note however that WebGL2 does not support storage buffers, so consider alternative options in this case. Dynamic /// storage buffers support multiple separate bindings at dynamic byte offsets and so have a -/// [`push`](crate::render_resource::DynamicStorageBuffer::push) method. +/// [`push`](DynamicStorageBuffer::push) method. /// -/// The contained data is stored in system RAM. [`write_buffer`](crate::render_resource::DynamicStorageBuffer::write_buffer) +/// The contained data is stored in system RAM. [`write_buffer`](DynamicStorageBuffer::write_buffer) /// queues copying of the data from system RAM to VRAM. The data within a storage buffer binding must conform to /// [std430 alignment/padding requirements]. `DynamicStorageBuffer` takes care of serialising the inner type to conform to -/// these requirements. Each item [`push`](crate::render_resource::DynamicStorageBuffer::push)ed into this structure +/// these requirements. Each item [`push`](DynamicStorageBuffer::push)ed into this structure /// will additionally be aligned to meet dynamic offset alignment requirements. /// /// Other options for storing GPU-accessible data are: diff --git a/crates/bevy_render/src/render_resource/uniform_buffer.rs b/crates/bevy_render/src/render_resource/uniform_buffer.rs index 7e1b86869c4e0..2a22cd93529fb 100644 --- a/crates/bevy_render/src/render_resource/uniform_buffer.rs +++ b/crates/bevy_render/src/render_resource/uniform_buffer.rs @@ -21,7 +21,7 @@ use super::IntoBinding; /// parameters that are constant during shader execution, and are best used for data that is relatively small in size as they are /// only guaranteed to support up to 16kB per binding. /// -/// The contained data is stored in system RAM. [`write_buffer`](crate::render_resource::UniformBuffer::write_buffer) queues +/// The contained data is stored in system RAM. [`write_buffer`](UniformBuffer::write_buffer) queues /// copying of the data from system RAM to VRAM. Data in uniform buffers must follow [std140 alignment/padding requirements], /// which is automatically enforced by this structure. Per the WGPU spec, uniform buffers cannot store runtime-sized array /// (vectors), or structures with fields that are vectors. @@ -157,7 +157,7 @@ impl<'a, T: ShaderType + WriteInto> IntoBinding<'a> for &'a UniformBuffer { /// available to shaders runtime-sized arrays of parameters that are otherwise constant during shader execution, and are best /// suited to data that is relatively small in size as they are only guaranteed to support up to 16kB per binding. /// -/// The contained data is stored in system RAM. [`write_buffer`](crate::render_resource::DynamicUniformBuffer::write_buffer) queues +/// The contained data is stored in system RAM. [`write_buffer`](DynamicUniformBuffer::write_buffer) queues /// copying of the data from system RAM to VRAM. Data in uniform buffers must follow [std140 alignment/padding requirements], /// which is automatically enforced by this structure. Per the WGPU spec, uniform buffers cannot store runtime-sized array /// (vectors), or structures with fields that are vectors. @@ -368,7 +368,7 @@ impl<'a, T: ShaderType + WriteInto> DynamicUniformBufferWriter<'a, T> { } /// A wrapper to work around the orphan rule so that [`wgpu::QueueWriteBufferView`] can implement -/// [`encase::internal::BufferMut`]. +/// [`BufferMut`]. struct QueueWriteBufferViewWrapper<'a> { buffer_view: wgpu::QueueWriteBufferView<'a>, // Must be kept separately and cannot be retrieved from buffer_view, as the read-only access will diff --git a/crates/bevy_render/src/renderer/mod.rs b/crates/bevy_render/src/renderer/mod.rs index 73992091ea57e..684309e1b8b3f 100644 --- a/crates/bevy_render/src/renderer/mod.rs +++ b/crates/bevy_render/src/renderer/mod.rs @@ -105,7 +105,7 @@ pub fn render_system(world: &mut World) { pub struct RenderQueue(pub Arc); /// The handle to the physical device being used for rendering. -/// See [`wgpu::Adapter`] for more info. +/// See [`Adapter`] for more info. #[derive(Resource, Clone, Debug, Deref, DerefMut)] pub struct RenderAdapter(pub Arc); diff --git a/crates/bevy_render/src/settings.rs b/crates/bevy_render/src/settings.rs index d64312425adf3..c38bf843f0ab2 100644 --- a/crates/bevy_render/src/settings.rs +++ b/crates/bevy_render/src/settings.rs @@ -18,8 +18,8 @@ pub enum WgpuSettingsPriority { WebGL2, } -/// Provides configuration for renderer initialization. Use [`RenderDevice::features`](crate::renderer::RenderDevice::features), -/// [`RenderDevice::limits`](crate::renderer::RenderDevice::limits), and the [`RenderAdapterInfo`] +/// Provides configuration for renderer initialization. Use [`RenderDevice::features`](RenderDevice::features), +/// [`RenderDevice::limits`](RenderDevice::limits), and the [`RenderAdapterInfo`] /// resource to get runtime information about the actual adapter, backend, features, and limits. /// NOTE: [`Backends::DX12`](Backends::DX12), [`Backends::METAL`](Backends::METAL), and /// [`Backends::VULKAN`](Backends::VULKAN) are enabled by default for non-web and the best choice diff --git a/crates/bevy_render/src/texture/compressed_image_saver.rs b/crates/bevy_render/src/texture/compressed_image_saver.rs index 5fe533ba196c4..a5f296b566a65 100644 --- a/crates/bevy_render/src/texture/compressed_image_saver.rs +++ b/crates/bevy_render/src/texture/compressed_image_saver.rs @@ -24,7 +24,7 @@ impl AssetSaver for CompressedImageSaver { writer: &'a mut bevy_asset::io::Writer, image: SavedAsset<'a, Self::Asset>, _settings: &'a Self::Settings, - ) -> bevy_utils::BoxedFuture<'a, std::result::Result> { + ) -> bevy_utils::BoxedFuture<'a, Result> { // PERF: this should live inside the future, but CompressorParams and Compressor are not Send / can't be owned by the BoxedFuture (which _is_ Send) let mut compressor_params = basis_universal::CompressorParams::new(); compressor_params.set_basis_format(basis_universal::BasisTextureFormat::UASTC4x4); diff --git a/crates/bevy_render/src/texture/image.rs b/crates/bevy_render/src/texture/image.rs index 45867dd890538..91c995580dcf2 100644 --- a/crates/bevy_render/src/texture/image.rs +++ b/crates/bevy_render/src/texture/image.rs @@ -109,7 +109,7 @@ pub struct Image { pub texture_descriptor: wgpu::TextureDescriptor<'static>, /// The [`ImageSampler`] to use during rendering. pub sampler: ImageSampler, - pub texture_view_descriptor: Option>, + pub texture_view_descriptor: Option>, } /// Used in [`Image`], this determines what image sampler to use when rendering. The default setting, @@ -444,18 +444,18 @@ impl<'a> From> for ImageSamplerDescriptor { impl Default for Image { /// default is a 1x1x1 all '1.0' texture fn default() -> Self { - let format = wgpu::TextureFormat::bevy_default(); + let format = TextureFormat::bevy_default(); let data = vec![255; format.pixel_size()]; Image { data, texture_descriptor: wgpu::TextureDescriptor { - size: wgpu::Extent3d { + size: Extent3d { width: 1, height: 1, depth_or_array_layers: 1, }, format, - dimension: wgpu::TextureDimension::D2, + dimension: TextureDimension::D2, label: None, mip_level_count: 1, sample_count: 1, diff --git a/crates/bevy_render/src/texture/image_loader.rs b/crates/bevy_render/src/texture/image_loader.rs index ec79c9d13e4cb..ca1df0b3b3d60 100644 --- a/crates/bevy_render/src/texture/image_loader.rs +++ b/crates/bevy_render/src/texture/image_loader.rs @@ -137,7 +137,7 @@ pub struct FileTextureError { path: String, } impl std::fmt::Display for FileTextureError { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> { write!( f, "Error reading image file {}: {}, this is an error in `bevy_render`.", diff --git a/crates/bevy_render/src/texture/texture_cache.rs b/crates/bevy_render/src/texture/texture_cache.rs index 30b031feede3e..3c15f3354a83e 100644 --- a/crates/bevy_render/src/texture/texture_cache.rs +++ b/crates/bevy_render/src/texture/texture_cache.rs @@ -28,7 +28,7 @@ pub struct CachedTexture { /// are only required for one frame. #[derive(Resource, Default)] pub struct TextureCache { - textures: HashMap, Vec>, + textures: HashMap, Vec>, } impl TextureCache { diff --git a/crates/bevy_render/src/view/visibility/mod.rs b/crates/bevy_render/src/view/visibility/mod.rs index 49bb64b689c0e..aa23826430a26 100644 --- a/crates/bevy_render/src/view/visibility/mod.rs +++ b/crates/bevy_render/src/view/visibility/mod.rs @@ -46,7 +46,7 @@ pub enum Visibility { } // Allows `&Visibility == Visibility` -impl std::cmp::PartialEq for &Visibility { +impl PartialEq for &Visibility { #[inline] fn eq(&self, other: &Visibility) -> bool { **self == *other @@ -54,7 +54,7 @@ impl std::cmp::PartialEq for &Visibility { } // Allows `Visibility == &Visibility` -impl std::cmp::PartialEq<&Visibility> for Visibility { +impl PartialEq<&Visibility> for Visibility { #[inline] fn eq(&self, other: &&Visibility) -> bool { *self == **other diff --git a/crates/bevy_render/src/view/visibility/render_layers.rs b/crates/bevy_render/src/view/visibility/render_layers.rs index 0451e35818f15..811d29698dec1 100644 --- a/crates/bevy_render/src/view/visibility/render_layers.rs +++ b/crates/bevy_render/src/view/visibility/render_layers.rs @@ -32,7 +32,7 @@ impl std::fmt::Debug for RenderLayers { } } -impl std::iter::FromIterator for RenderLayers { +impl FromIterator for RenderLayers { fn from_iter>(i: T) -> Self { i.into_iter().fold(Self::none(), |mask, g| mask.with(g)) } @@ -174,7 +174,7 @@ mod rendering_mask_tests { ); assert_eq!( RenderLayers::from_layers(&[0, 1, 2]), - >::from_iter(vec![0, 1, 2]), + >::from_iter(vec![0, 1, 2]), "from_layers and from_iter are equivalent" ); } diff --git a/crates/bevy_render/src/view/window/mod.rs b/crates/bevy_render/src/view/window/mod.rs index b9e62c6a6b151..ddbb878d219af 100644 --- a/crates/bevy_render/src/view/window/mod.rs +++ b/crates/bevy_render/src/view/window/mod.rs @@ -284,7 +284,7 @@ pub fn prepare_windows( format: surface_data.format, width: window.physical_width, height: window.physical_height, - usage: wgpu::TextureUsages::RENDER_ATTACHMENT, + usage: TextureUsages::RENDER_ATTACHMENT, present_mode: match window.present_mode { PresentMode::Fifo => wgpu::PresentMode::Fifo, PresentMode::FifoRelaxed => wgpu::PresentMode::FifoRelaxed, diff --git a/crates/bevy_render/src/view/window/screenshot.rs b/crates/bevy_render/src/view/window/screenshot.rs index c219c3f243492..9c6732b2999be 100644 --- a/crates/bevy_render/src/view/window/screenshot.rs +++ b/crates/bevy_render/src/view/window/screenshot.rs @@ -153,8 +153,8 @@ impl Plugin for ScreenshotPlugin { #[cfg(feature = "bevy_ci_testing")] fn ci_testing_screenshot_at( - mut current_frame: bevy_ecs::prelude::Local, - ci_testing_config: bevy_ecs::prelude::Res, + mut current_frame: Local, + ci_testing_config: Res, mut screenshot_manager: ResMut, main_window: Query>, ) { @@ -268,7 +268,7 @@ pub(crate) fn submit_screenshot_commands(world: &World, encoder: &mut CommandEnc memory.texture.as_image_copy(), wgpu::ImageCopyBuffer { buffer: &memory.buffer, - layout: crate::view::screenshot::layout_data(width, height, texture_format), + layout: layout_data(width, height, texture_format), }, Extent3d { width, diff --git a/crates/bevy_scene/src/serde.rs b/crates/bevy_scene/src/serde.rs index 8180e227a8ce8..6ca7d0e301630 100644 --- a/crates/bevy_scene/src/serde.rs +++ b/crates/bevy_scene/src/serde.rs @@ -88,7 +88,7 @@ impl<'a> SceneSerializer<'a> { impl<'a> Serialize for SceneSerializer<'a> { fn serialize(&self, serializer: S) -> Result where - S: serde::Serializer, + S: Serializer, { let mut state = serializer.serialize_struct(SCENE_STRUCT, 2)?; state.serialize_field( @@ -147,7 +147,7 @@ pub struct EntitySerializer<'a> { impl<'a> Serialize for EntitySerializer<'a> { fn serialize(&self, serializer: S) -> Result where - S: serde::Serializer, + S: Serializer, { let mut state = serializer.serialize_struct(ENTITY_STRUCT, 1)?; state.serialize_field( @@ -176,7 +176,7 @@ pub struct SceneMapSerializer<'a> { impl<'a> Serialize for SceneMapSerializer<'a> { fn serialize(&self, serializer: S) -> Result where - S: serde::Serializer, + S: Serializer, { let mut state = serializer.serialize_map(Some(self.entries.len()))?; for reflect in self.entries { @@ -213,7 +213,7 @@ impl<'a, 'de> DeserializeSeed<'de> for SceneDeserializer<'a> { fn deserialize(self, deserializer: D) -> Result where - D: serde::Deserializer<'de>, + D: Deserializer<'de>, { deserializer.deserialize_struct( SCENE_STRUCT, @@ -236,7 +236,7 @@ impl<'a, 'de> Visitor<'de> for SceneVisitor<'a> { formatter.write_str("scene struct") } - fn visit_map(self, mut map: A) -> std::result::Result + fn visit_map(self, mut map: A) -> Result where A: MapAccess<'de>, { @@ -321,7 +321,7 @@ struct SceneEntitiesVisitor<'a> { impl<'a, 'de> Visitor<'de> for SceneEntitiesVisitor<'a> { type Value = Vec; - fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { + fn expecting(&self, formatter: &mut Formatter) -> std::fmt::Result { formatter.write_str("map of entities") } @@ -355,7 +355,7 @@ impl<'a, 'de> DeserializeSeed<'de> for SceneEntityDeserializer<'a> { fn deserialize(self, deserializer: D) -> Result where - D: serde::Deserializer<'de>, + D: Deserializer<'de>, { deserializer.deserialize_struct( ENTITY_STRUCT, @@ -376,11 +376,11 @@ struct SceneEntityVisitor<'a> { impl<'a, 'de> Visitor<'de> for SceneEntityVisitor<'a> { type Value = DynamicEntity; - fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { + fn expecting(&self, formatter: &mut Formatter) -> std::fmt::Result { formatter.write_str("entities") } - fn visit_seq(self, mut seq: A) -> std::result::Result + fn visit_seq(self, mut seq: A) -> Result where A: SeqAccess<'de>, { @@ -436,7 +436,7 @@ impl<'a, 'de> DeserializeSeed<'de> for SceneMapDeserializer<'a> { fn deserialize(self, deserializer: D) -> Result where - D: serde::Deserializer<'de>, + D: Deserializer<'de>, { deserializer.deserialize_map(SceneMapVisitor { registry: self.registry, @@ -451,11 +451,11 @@ struct SceneMapVisitor<'a> { impl<'a, 'de> Visitor<'de> for SceneMapVisitor<'a> { type Value = Vec>; - fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { + fn expecting(&self, formatter: &mut Formatter) -> std::fmt::Result { formatter.write_str("map of reflect types") } - fn visit_map(self, mut map: A) -> std::result::Result + fn visit_map(self, mut map: A) -> Result where A: MapAccess<'de>, { diff --git a/crates/bevy_tasks/src/iter/mod.rs b/crates/bevy_tasks/src/iter/mod.rs index 952bc53075551..6887fa05440a1 100644 --- a/crates/bevy_tasks/src/iter/mod.rs +++ b/crates/bevy_tasks/src/iter/mod.rs @@ -192,7 +192,7 @@ where // TODO: Investigate optimizations for less copying fn collect(mut self, pool: &TaskPool) -> C where - C: std::iter::FromIterator, + C: FromIterator, BatchIter::Item: Send + 'static, { pool.scope(|s| { diff --git a/crates/bevy_tasks/src/task_pool.rs b/crates/bevy_tasks/src/task_pool.rs index 4c37ef3b7a190..6b8bcdcf7d5d5 100644 --- a/crates/bevy_tasks/src/task_pool.rs +++ b/crates/bevy_tasks/src/task_pool.rs @@ -823,17 +823,17 @@ mod tests { let count_clone = count.clone(); let inner_pool = pool.clone(); let inner_thread_check_failed = thread_check_failed.clone(); - std::thread::spawn(move || { + thread::spawn(move || { inner_pool.scope(|scope| { let inner_count_clone = count_clone.clone(); scope.spawn(async move { inner_count_clone.fetch_add(1, Ordering::Release); }); - let spawner = std::thread::current().id(); + let spawner = thread::current().id(); let inner_count_clone = count_clone.clone(); scope.spawn_on_scope(async move { inner_count_clone.fetch_add(1, Ordering::Release); - if std::thread::current().id() != spawner { + if thread::current().id() != spawner { // NOTE: This check is using an atomic rather than simply panicking the // thread to avoid deadlocking the barrier on failure inner_thread_check_failed.store(true, Ordering::Release); @@ -898,9 +898,9 @@ mod tests { let count_clone = count.clone(); let inner_pool = pool.clone(); let inner_thread_check_failed = thread_check_failed.clone(); - std::thread::spawn(move || { + thread::spawn(move || { inner_pool.scope(|scope| { - let spawner = std::thread::current().id(); + let spawner = thread::current().id(); let inner_count_clone = count_clone.clone(); scope.spawn(async move { inner_count_clone.fetch_add(1, Ordering::Release); @@ -908,7 +908,7 @@ mod tests { // spawning on the scope from another thread runs the futures on the scope's thread scope.spawn_on_scope(async move { inner_count_clone.fetch_add(1, Ordering::Release); - if std::thread::current().id() != spawner { + if thread::current().id() != spawner { // NOTE: This check is using an atomic rather than simply panicking the // thread to avoid deadlocking the barrier on failure inner_thread_check_failed.store(true, Ordering::Release); diff --git a/crates/bevy_tasks/src/thread_executor.rs b/crates/bevy_tasks/src/thread_executor.rs index 0131de91bec56..81f51b689c7c0 100644 --- a/crates/bevy_tasks/src/thread_executor.rs +++ b/crates/bevy_tasks/src/thread_executor.rs @@ -123,7 +123,7 @@ mod tests { let ticker = executor.ticker(); assert!(ticker.is_some()); - std::thread::scope(|s| { + thread::scope(|s| { s.spawn(|| { let ticker = executor.ticker(); assert!(ticker.is_none()); diff --git a/crates/bevy_text/src/glyph_brush.rs b/crates/bevy_text/src/glyph_brush.rs index a00d71a779cb1..8576145b7b3c4 100644 --- a/crates/bevy_text/src/glyph_brush.rs +++ b/crates/bevy_text/src/glyph_brush.rs @@ -208,7 +208,7 @@ impl GlyphPlacementAdjuster { pub(crate) fn compute_text_bounds( section_glyphs: &[SectionGlyph], get_scaled_font: impl Fn(usize) -> PxScaleFont, -) -> bevy_math::Rect +) -> Rect where T: ab_glyph::Font, { diff --git a/crates/bevy_text/src/lib.rs b/crates/bevy_text/src/lib.rs index bdbc1e168377e..c4ab6040de55a 100644 --- a/crates/bevy_text/src/lib.rs +++ b/crates/bevy_text/src/lib.rs @@ -99,7 +99,7 @@ impl Plugin for TextPlugin { // will only ever observe its own render target, and `update_text2d_layout` // will never modify a pre-existing `Image` asset. .ambiguous_with(CameraUpdateSystem), - font_atlas_set::remove_dropped_font_atlas_sets, + remove_dropped_font_atlas_sets, ), ); diff --git a/crates/bevy_transform/src/components/transform.rs b/crates/bevy_transform/src/components/transform.rs index 95a5881858e1c..3e1e79c5af637 100644 --- a/crates/bevy_transform/src/components/transform.rs +++ b/crates/bevy_transform/src/components/transform.rs @@ -34,7 +34,7 @@ use std::ops::Mul; /// /// [`global_vs_local_translation`]: https://github.com/bevyengine/bevy/blob/latest/examples/transforms/global_vs_local_translation.rs /// [`transform`]: https://github.com/bevyengine/bevy/blob/latest/examples/transforms/transform.rs -/// [`Transform`]: super::Transform +/// [`Transform`]: Transform #[derive(Component, Debug, PartialEq, Clone, Copy, Reflect)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[reflect(Component, Default, PartialEq)] diff --git a/crates/bevy_transform/src/lib.rs b/crates/bevy_transform/src/lib.rs index c7d16ea989a13..b8c0034355c55 100644 --- a/crates/bevy_transform/src/lib.rs +++ b/crates/bevy_transform/src/lib.rs @@ -41,7 +41,7 @@ use systems::{propagate_transforms, sync_simple_transforms}; /// [`GlobalTransform`] is the position of an entity relative to the reference frame. /// /// [`GlobalTransform`] is updated from [`Transform`] by systems in the system set -/// [`TransformPropagate`](crate::TransformSystem::TransformPropagate). +/// [`TransformPropagate`](TransformSystem::TransformPropagate). /// /// This system runs during [`PostUpdate`]. If you /// update the [`Transform`] of an entity in this schedule or after, you will notice a 1 frame lag diff --git a/crates/bevy_ui/src/layout/convert.rs b/crates/bevy_ui/src/layout/convert.rs index 57882b1fe326e..71f2d5ec22a97 100644 --- a/crates/bevy_ui/src/layout/convert.rs +++ b/crates/bevy_ui/src/layout/convert.rs @@ -350,7 +350,7 @@ impl GridTrack { ) -> taffy::style::NonRepeatedTrackSizingFunction { let min = self.min_sizing_function.into_taffy(context); let max = self.max_sizing_function.into_taffy(context); - taffy::style_helpers::minmax(min, max) + style_helpers::minmax(min, max) } } @@ -362,7 +362,7 @@ impl RepeatedGridTrack { if self.tracks.len() == 1 && self.repetition == GridTrackRepetition::Count(1) { let min = self.tracks[0].min_sizing_function.into_taffy(context); let max = self.tracks[0].max_sizing_function.into_taffy(context); - let taffy_track = taffy::style_helpers::minmax(min, max); + let taffy_track = style_helpers::minmax(min, max); taffy::style::TrackSizingFunction::Single(taffy_track) } else { let taffy_tracks: Vec<_> = self @@ -371,22 +371,18 @@ impl RepeatedGridTrack { .map(|track| { let min = track.min_sizing_function.into_taffy(context); let max = track.max_sizing_function.into_taffy(context); - taffy::style_helpers::minmax(min, max) + style_helpers::minmax(min, max) }) .collect(); match self.repetition { - GridTrackRepetition::Count(count) => { - taffy::style_helpers::repeat(count, taffy_tracks) + GridTrackRepetition::Count(count) => style_helpers::repeat(count, taffy_tracks), + GridTrackRepetition::AutoFit => { + style_helpers::repeat(taffy::style::GridTrackRepetition::AutoFit, taffy_tracks) + } + GridTrackRepetition::AutoFill => { + style_helpers::repeat(taffy::style::GridTrackRepetition::AutoFill, taffy_tracks) } - GridTrackRepetition::AutoFit => taffy::style_helpers::repeat( - taffy::style::GridTrackRepetition::AutoFit, - taffy_tracks, - ), - GridTrackRepetition::AutoFill => taffy::style_helpers::repeat( - taffy::style::GridTrackRepetition::AutoFill, - taffy_tracks, - ), } } } @@ -401,7 +397,7 @@ mod tests { use sh::TaffyZero; use taffy::style_helpers as sh; - let bevy_style = crate::Style { + let bevy_style = Style { display: Display::Flex, position_type: PositionType::Absolute, left: Val::ZERO, diff --git a/crates/bevy_ui/src/lib.rs b/crates/bevy_ui/src/lib.rs index c4d874dffd6ec..756145d8946af 100644 --- a/crates/bevy_ui/src/lib.rs +++ b/crates/bevy_ui/src/lib.rs @@ -191,7 +191,7 @@ impl Plugin for UiPlugin { ), ); - crate::render::build_ui_render(app); + build_ui_render(app); } fn finish(&self, app: &mut App) { diff --git a/crates/bevy_ui/src/render/ui_material_pipeline.rs b/crates/bevy_ui/src/render/ui_material_pipeline.rs index 7892efa4541eb..b383c26f86f22 100644 --- a/crates/bevy_ui/src/render/ui_material_pipeline.rs +++ b/crates/bevy_ui/src/render/ui_material_pipeline.rs @@ -49,7 +49,7 @@ impl Plugin for UiMaterialPlugin where M::Data: PartialEq + Eq + Hash + Clone, { - fn build(&self, app: &mut bevy_app::App) { + fn build(&self, app: &mut App) { load_internal_asset!( app, UI_VERTEX_OUTPUT_SHADER_HANDLE, diff --git a/crates/bevy_utils/src/default.rs b/crates/bevy_utils/src/default.rs index 213cfd3d6c7e6..36f3e054ae94c 100644 --- a/crates/bevy_utils/src/default.rs +++ b/crates/bevy_utils/src/default.rs @@ -26,5 +26,5 @@ /// ``` #[inline] pub fn default() -> T { - std::default::Default::default() + Default::default() } diff --git a/crates/bevy_utils/src/futures.rs b/crates/bevy_utils/src/futures.rs index 6e185144021f4..3c1137462cad5 100644 --- a/crates/bevy_utils/src/futures.rs +++ b/crates/bevy_utils/src/futures.rs @@ -1,6 +1,6 @@ //! Utilities for working with [`Future`]s. //! -//! [`Future`]: std::future::Future +//! [`Future`]: Future use std::{ future::Future, pin::Pin, diff --git a/crates/bevy_utils/src/intern.rs b/crates/bevy_utils/src/intern.rs index 27473ce471280..05c4834c97af6 100644 --- a/crates/bevy_utils/src/intern.rs +++ b/crates/bevy_utils/src/intern.rs @@ -190,7 +190,7 @@ mod tests { std::ptr::eq(self, other) } - fn ref_hash(&self, state: &mut H) { + fn ref_hash(&self, state: &mut H) { std::ptr::hash(self, state); } } @@ -221,7 +221,7 @@ mod tests { std::ptr::eq(self, other) } - fn ref_hash(&self, state: &mut H) { + fn ref_hash(&self, state: &mut H) { std::ptr::hash(self, state); } } diff --git a/crates/bevy_utils/src/label.rs b/crates/bevy_utils/src/label.rs index 20b63f8850b72..6a372a4f69e7f 100644 --- a/crates/bevy_utils/src/label.rs +++ b/crates/bevy_utils/src/label.rs @@ -42,7 +42,7 @@ pub trait DynHash: DynEq { /// Feeds this value into the given [`Hasher`]. /// - /// [`Hasher`]: std::hash::Hasher + /// [`Hasher`]: Hasher fn dyn_hash(&self, state: &mut dyn Hasher); } @@ -126,7 +126,7 @@ macro_rules! define_label { /// Feeds this value into the given [`Hasher`]. /// - /// [`Hasher`]: std::hash::Hasher + /// [`Hasher`]: Hasher fn dyn_hash(&self, state: &mut dyn ::std::hash::Hasher); /// Returns an [`Interned`](bevy_utils::intern::Interned) value corresponding to `self`. diff --git a/crates/bevy_utils/src/lib.rs b/crates/bevy_utils/src/lib.rs index 0660de4a60f0c..fadbf1c1a0606 100644 --- a/crates/bevy_utils/src/lib.rs +++ b/crates/bevy_utils/src/lib.rs @@ -67,7 +67,7 @@ pub type Entry<'a, K, V> = hashbrown::hash_map::Entry<'a, K, V, BuildHasherDefau #[derive(Debug, Clone, Default)] pub struct FixedState; -impl std::hash::BuildHasher for FixedState { +impl BuildHasher for FixedState { type Hasher = AHasher; #[inline] diff --git a/crates/bevy_utils/src/uuid.rs b/crates/bevy_utils/src/uuid.rs index 35edd2353f428..3542c9411eee0 100644 --- a/crates/bevy_utils/src/uuid.rs +++ b/crates/bevy_utils/src/uuid.rs @@ -3,7 +3,7 @@ //! This module re-exports the [`Uuid`] type from the [`uuid`] crate, //! and provides additional utility functions. //! -//! [`uuid`]: ::uuid +//! [`uuid`]: uuid pub use ::uuid::Uuid; diff --git a/crates/bevy_window/src/window.rs b/crates/bevy_window/src/window.rs index b0573eeb25a08..be62c8c6a8844 100644 --- a/crates/bevy_window/src/window.rs +++ b/crates/bevy_window/src/window.rs @@ -750,14 +750,14 @@ where } } -impl From for WindowResolution { - fn from(res: bevy_math::Vec2) -> WindowResolution { +impl From for WindowResolution { + fn from(res: Vec2) -> WindowResolution { WindowResolution::new(res.x, res.y) } } -impl From for WindowResolution { - fn from(res: bevy_math::DVec2) -> WindowResolution { +impl From for WindowResolution { + fn from(res: DVec2) -> WindowResolution { WindowResolution::new(res.x as f32, res.y as f32) } } diff --git a/crates/bevy_winit/src/lib.rs b/crates/bevy_winit/src/lib.rs index 49754ec29bd4d..83281133e35de 100644 --- a/crates/bevy_winit/src/lib.rs +++ b/crates/bevy_winit/src/lib.rs @@ -429,7 +429,7 @@ pub fn winit_runner(mut app: App) { } match event { - event::Event::NewEvents(start_cause) => match start_cause { + Event::NewEvents(start_cause) => match start_cause { StartCause::Init => { #[cfg(any(target_os = "ios", target_os = "macos"))] { @@ -480,7 +480,7 @@ pub fn winit_runner(mut app: App) { } } }, - event::Event::WindowEvent { + Event::WindowEvent { event, window_id, .. } => { let (mut event_writers, winit_windows, mut windows, access_kit_adapters) = @@ -740,7 +740,7 @@ pub fn winit_runner(mut app: App) { cache.window = window.clone(); } } - event::Event::DeviceEvent { + Event::DeviceEvent { event: DeviceEvent::MouseMotion { delta: (x, y) }, .. } => { @@ -749,14 +749,14 @@ pub fn winit_runner(mut app: App) { delta: Vec2::new(x as f32, y as f32), }); } - event::Event::Suspended => { + Event::Suspended => { let (mut event_writers, ..) = event_writer_system_state.get_mut(&mut app.world); event_writers.lifetime.send(ApplicationLifetime::Suspended); // Mark the state as `WillSuspend`. This will let the schedule run one last time // before actually suspending to let the application react runner_state.active = ActiveState::WillSuspend; } - event::Event::Resumed => { + Event::Resumed => { let (mut event_writers, ..) = event_writer_system_state.get_mut(&mut app.world); match runner_state.active { ActiveState::NotYetStarted => { @@ -807,7 +807,7 @@ pub fn winit_runner(mut app: App) { *control_flow = ControlFlow::Poll; } } - event::Event::MainEventsCleared => { + Event::MainEventsCleared => { if runner_state.active.should_run() { if runner_state.active == ActiveState::WillSuspend { runner_state.active = ActiveState::Suspended; diff --git a/crates/bevy_winit/src/winit_windows.rs b/crates/bevy_winit/src/winit_windows.rs index 43c0e414b2956..501a438669c43 100644 --- a/crates/bevy_winit/src/winit_windows.rs +++ b/crates/bevy_winit/src/winit_windows.rs @@ -239,7 +239,7 @@ impl WinitWindows { /// /// The heuristic for "best" prioritizes width, height, and refresh rate in that order. pub fn get_fitting_videomode( - monitor: &winit::monitor::MonitorHandle, + monitor: &MonitorHandle, width: u32, height: u32, ) -> winit::monitor::VideoMode { @@ -273,7 +273,7 @@ pub fn get_fitting_videomode( /// Gets the "best" videomode from a monitor. /// /// The heuristic for "best" prioritizes width, height, and refresh rate in that order. -pub fn get_best_videomode(monitor: &winit::monitor::MonitorHandle) -> winit::monitor::VideoMode { +pub fn get_best_videomode(monitor: &MonitorHandle) -> winit::monitor::VideoMode { let mut modes = monitor.video_modes().collect::>(); modes.sort_by(|a, b| { use std::cmp::Ordering::*; @@ -293,21 +293,19 @@ pub fn get_best_videomode(monitor: &winit::monitor::MonitorHandle) -> winit::mon pub(crate) fn attempt_grab(winit_window: &winit::window::Window, grab_mode: CursorGrabMode) { let grab_result = match grab_mode { - bevy_window::CursorGrabMode::None => { - winit_window.set_cursor_grab(winit::window::CursorGrabMode::None) - } - bevy_window::CursorGrabMode::Confined => winit_window + CursorGrabMode::None => winit_window.set_cursor_grab(winit::window::CursorGrabMode::None), + CursorGrabMode::Confined => winit_window .set_cursor_grab(winit::window::CursorGrabMode::Confined) .or_else(|_e| winit_window.set_cursor_grab(winit::window::CursorGrabMode::Locked)), - bevy_window::CursorGrabMode::Locked => winit_window + CursorGrabMode::Locked => winit_window .set_cursor_grab(winit::window::CursorGrabMode::Locked) .or_else(|_e| winit_window.set_cursor_grab(winit::window::CursorGrabMode::Confined)), }; if let Err(err) = grab_result { let err_desc = match grab_mode { - bevy_window::CursorGrabMode::Confined | bevy_window::CursorGrabMode::Locked => "grab", - bevy_window::CursorGrabMode::None => "ungrab", + CursorGrabMode::Confined | CursorGrabMode::Locked => "grab", + CursorGrabMode::None => "ungrab", }; bevy_utils::tracing::error!("Unable to {} cursor: {}", err_desc, err); diff --git a/examples/2d/mesh2d.rs b/examples/2d/mesh2d.rs index 2bd8bce06078a..bc419e532180b 100644 --- a/examples/2d/mesh2d.rs +++ b/examples/2d/mesh2d.rs @@ -1,6 +1,6 @@ //! Shows how to render a polygonal [`Mesh`], generated from a [`Quad`] primitive, in a 2D scene. //! -//! [`Quad`]: bevy::prelude::shape::Quad +//! [`Quad`]: shape::Quad use bevy::{prelude::*, sprite::MaterialMesh2dBundle}; diff --git a/examples/2d/mesh2d_vertex_color_texture.rs b/examples/2d/mesh2d_vertex_color_texture.rs index b1df7bf2c4107..1e439e28c9d16 100644 --- a/examples/2d/mesh2d_vertex_color_texture.rs +++ b/examples/2d/mesh2d_vertex_color_texture.rs @@ -1,7 +1,7 @@ //! Shows how to render a polygonal [`Mesh`], generated from a [`Quad`] primitive, in a 2D scene. //! Adds a texture and colored vertices, giving per-vertex tinting. //! -//! [`Quad`]: bevy::prelude::shape::Quad +//! [`Quad`]: shape::Quad use bevy::{ prelude::*, diff --git a/examples/ecs/one_shot_systems.rs b/examples/ecs/one_shot_systems.rs index e294ca4b67a71..2cf3a02b5cc73 100644 --- a/examples/ecs/one_shot_systems.rs +++ b/examples/ecs/one_shot_systems.rs @@ -4,8 +4,8 @@ //! reducing the overhead of running extremely rarely run systems //! and improving schedule flexibility. //! -//! See the [`World::run_system`](bevy::ecs::prelude::World::run_system) or -//! [`World::run_system_once`](bevy::ecs::prelude::World#method.run_system_once_with) +//! See the [`World::run_system`](World::run_system) or +//! [`World::run_system_once`](World#method.run_system_once_with) //! docs for more details. use bevy::{ diff --git a/examples/ecs/system_piping.rs b/examples/ecs/system_piping.rs index 0863daa700797..7cd5f2c1bd475 100644 --- a/examples/ecs/system_piping.rs +++ b/examples/ecs/system_piping.rs @@ -23,7 +23,7 @@ fn main() { parse_message_system.map(dbg), warning_pipe_system.map(warn), parse_error_message_system.map(error), - parse_message_system.map(std::mem::drop), + parse_message_system.map(drop), ), ) .run(); diff --git a/tests/window/resizing.rs b/tests/window/resizing.rs index 0f04eb2567970..0d9135989c164 100644 --- a/tests/window/resizing.rs +++ b/tests/window/resizing.rs @@ -34,7 +34,7 @@ fn main() { width: MAX_WIDTH, height: MAX_HEIGHT, }) - .insert_resource(Phase::ContractingY) + .insert_resource(ContractingY) .add_systems(Startup, (setup_3d, setup_2d)) .add_systems( Update, @@ -72,28 +72,28 @@ fn change_window_size( let height = windows.height; let width = windows.width; match *phase { - Phase::ContractingY => { + ContractingY => { if height <= MIN_HEIGHT { *phase = ContractingX; } else { windows.height -= RESIZE_STEP; } } - Phase::ContractingX => { + ContractingX => { if width <= MIN_WIDTH { *phase = ExpandingY; } else { windows.width -= RESIZE_STEP; } } - Phase::ExpandingY => { + ExpandingY => { if height >= MAX_HEIGHT { *phase = ExpandingX; } else { windows.height += RESIZE_STEP; } } - Phase::ExpandingX => { + ExpandingX => { if width >= MAX_WIDTH { *phase = ContractingY; } else { diff --git a/tools/example-showcase/src/main.rs b/tools/example-showcase/src/main.rs index d06f26ccb29f4..5c0d5a9f5b8a8 100644 --- a/tools/example-showcase/src/main.rs +++ b/tools/example-showcase/src/main.rs @@ -649,7 +649,7 @@ header_message = \"Examples ({})\" } fn parse_examples() -> Vec { - let manifest_file = std::fs::read_to_string("Cargo.toml").unwrap(); + let manifest_file = fs::read_to_string("Cargo.toml").unwrap(); let manifest = manifest_file.parse::().unwrap(); let metadatas = manifest .get("package") From 4943e735802775316efffe5edea3e8be9ae0aa13 Mon Sep 17 00:00:00 2001 From: tygyh Date: Sun, 26 Nov 2023 15:30:10 +0100 Subject: [PATCH 2/4] Readd prefix path to doc comment --- crates/bevy_pbr/src/light.rs | 6 +++--- crates/bevy_pbr/src/pbr_material.rs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/bevy_pbr/src/light.rs b/crates/bevy_pbr/src/light.rs index 2e89c10867bec..3eaea9dbb2b9a 100644 --- a/crates/bevy_pbr/src/light.rs +++ b/crates/bevy_pbr/src/light.rs @@ -575,11 +575,11 @@ impl Default for AmbientLight { } } -/// Add this component to make a [`Mesh`](mesh::Mesh) not cast shadows. +/// Add this component to make a [`Mesh`](bevy_render::mesh::Mesh) not cast shadows. #[derive(Component, Reflect, Default)] #[reflect(Component, Default)] pub struct NotShadowCaster; -/// Add this component to make a [`Mesh`](mesh::Mesh) not receive shadows. +/// Add this component to make a [`Mesh`](bevy_render::mesh::Mesh) not receive shadows. /// /// **Note:** If you're using diffuse transmission, setting [`NotShadowReceiver`] will /// cause both “regular” shadows as well as diffusely transmitted shadows to be disabled, @@ -587,7 +587,7 @@ pub struct NotShadowCaster; #[derive(Component, Reflect, Default)] #[reflect(Component, Default)] pub struct NotShadowReceiver; -/// Add this component to make a [`Mesh`](mesh::Mesh) using a PBR material with [`diffuse_transmission`](crate::pbr_material::StandardMaterial::diffuse_transmission)`> 0.0` +/// Add this component to make a [`Mesh`](bevy_render::mesh::Mesh) using a PBR material with [`diffuse_transmission`](crate::pbr_material::StandardMaterial::diffuse_transmission)`> 0.0` /// receive shadows on its diffuse transmission lobe. (i.e. its “backside”) /// /// Not enabled by default, as it requires carefully setting up [`thickness`](crate::pbr_material::StandardMaterial::thickness) diff --git a/crates/bevy_pbr/src/pbr_material.rs b/crates/bevy_pbr/src/pbr_material.rs index 8df280a7fa283..77257bc8daadb 100644 --- a/crates/bevy_pbr/src/pbr_material.rs +++ b/crates/bevy_pbr/src/pbr_material.rs @@ -302,8 +302,8 @@ pub struct StandardMaterial { /// If your material has a normal map, but still renders as a flat surface, /// make sure your meshes have their tangents set. /// - /// [`Mesh::generate_tangents`]: mesh::Mesh::generate_tangents - /// [`Mesh::with_generated_tangents`]: mesh::Mesh::with_generated_tangents + /// [`Mesh::generate_tangents`]: bevy_render::mesh::Mesh::generate_tangents + /// [`Mesh::with_generated_tangents`]: bevy_render::mesh::Mesh::with_generated_tangents #[texture(9)] #[sampler(10)] #[dependency] @@ -352,7 +352,7 @@ pub struct StandardMaterial { /// /// Your 3D editing software should manage all of that. /// - /// [`Mesh`]: mesh::Mesh + /// [`Mesh`]: bevy_render::mesh::Mesh // TODO: include this in reflection somehow (maybe via remote types like serde https://serde.rs/remote-derive.html) #[reflect(ignore)] pub cull_mode: Option, From 6338964048ad228d768d99a56744b183a06de47e Mon Sep 17 00:00:00 2001 From: tygyh Date: Mon, 27 Nov 2023 23:39:23 +0100 Subject: [PATCH 3/4] Remove labels identical to descriptions --- crates/bevy_ecs/src/entity/map_entities.rs | 1 - crates/bevy_ecs/src/entity/mod.rs | 1 - crates/bevy_ecs/src/reflect/bundle.rs | 1 - crates/bevy_ecs/src/storage/blob_vec.rs | 1 - crates/bevy_ecs/src/storage/table.rs | 12 ------------ crates/bevy_ecs/src/system/mod.rs | 1 - crates/bevy_ecs/src/system/system_param.rs | 1 - crates/bevy_reflect/src/list.rs | 1 - crates/bevy_reflect/src/map.rs | 1 - crates/bevy_reflect/src/serde/de.rs | 6 ------ crates/bevy_reflect/src/type_info.rs | 1 - crates/bevy_reflect/src/type_registry.rs | 3 --- crates/bevy_render/src/camera/camera.rs | 1 - crates/bevy_transform/src/components/transform.rs | 1 - crates/bevy_utils/src/futures.rs | 2 -- crates/bevy_utils/src/label.rs | 4 ---- 16 files changed, 38 deletions(-) diff --git a/crates/bevy_ecs/src/entity/map_entities.rs b/crates/bevy_ecs/src/entity/map_entities.rs index afbfa4bf666e1..19890205723b8 100644 --- a/crates/bevy_ecs/src/entity/map_entities.rs +++ b/crates/bevy_ecs/src/entity/map_entities.rs @@ -30,7 +30,6 @@ use bevy_utils::EntityHashMap; /// } /// ``` /// -/// [`World`]: World pub trait MapEntities { /// Updates all [`Entity`] references stored inside using `entity_mapper`. /// diff --git a/crates/bevy_ecs/src/entity/mod.rs b/crates/bevy_ecs/src/entity/mod.rs index cacd61f764f76..0ac11ae04c63e 100644 --- a/crates/bevy_ecs/src/entity/mod.rs +++ b/crates/bevy_ecs/src/entity/mod.rs @@ -327,7 +327,6 @@ impl SparseSetIndex for Entity { } /// An [`Iterator`] returning a sequence of [`Entity`] values from -/// [`Entities::reserve_entities`](Entities::reserve_entities). pub struct ReserveEntitiesIterator<'a> { // Metas, so we can recover the current generation for anything in the freelist. meta: &'a [EntityMeta], diff --git a/crates/bevy_ecs/src/reflect/bundle.rs b/crates/bevy_ecs/src/reflect/bundle.rs index c848cec289ae7..e5ea2de2b16d8 100644 --- a/crates/bevy_ecs/src/reflect/bundle.rs +++ b/crates/bevy_ecs/src/reflect/bundle.rs @@ -118,7 +118,6 @@ impl ReflectBundle { /// and copy the subset of function pointers you care about. /// /// [`TypeRegistration::data::`]: bevy_reflect::TypeRegistration::data - /// [`TypeRegistry::get`]: TypeRegistry::get pub fn fn_pointers(&self) -> &ReflectBundleFns { &self.0 } diff --git a/crates/bevy_ecs/src/storage/blob_vec.rs b/crates/bevy_ecs/src/storage/blob_vec.rs index 17d50c1a57fe3..416ce2d964c5f 100644 --- a/crates/bevy_ecs/src/storage/blob_vec.rs +++ b/crates/bevy_ecs/src/storage/blob_vec.rs @@ -51,7 +51,6 @@ impl BlobVec { /// If `drop` is `None`, the items will be leaked. This should generally be set as None based on [`needs_drop`]. /// /// [`needs_drop`]: core::mem::needs_drop - /// [`Drop`]: Drop pub unsafe fn new( item_layout: Layout, drop: Option)>, diff --git a/crates/bevy_ecs/src/storage/table.rs b/crates/bevy_ecs/src/storage/table.rs index f6abbd3091caf..e1955bc598f89 100644 --- a/crates/bevy_ecs/src/storage/table.rs +++ b/crates/bevy_ecs/src/storage/table.rs @@ -72,7 +72,6 @@ impl TableId { /// [`Archetype`]: crate::archetype::Archetype /// [`Archetype::entity_table_row`]: crate::archetype::Archetype::entity_table_row /// [`Archetype::table_id`]: crate::archetype::Archetype::table_id -/// [`Entity`]: Entity #[derive(Debug, Clone, Copy, PartialEq, Eq)] // SAFETY: Must be repr(transparent) due to the safety requirements on EntityLocation #[repr(transparent)] @@ -192,7 +191,6 @@ impl Column { /// # Safety /// `row` must be within the range `[0, self.len())`. /// - /// [`Drop`]: Drop #[inline] pub(crate) unsafe fn swap_remove_unchecked(&mut self, row: TableRow) { self.data.swap_remove_and_drop_unchecked(row.index()); @@ -311,8 +309,6 @@ impl Column { /// /// # Safety /// The type `T` must be the type of the items in this column. - /// - /// [`UnsafeCell`]: UnsafeCell pub unsafe fn get_data_slice(&self) -> &[UnsafeCell] { self.data.get_slice() } @@ -322,8 +318,6 @@ impl Column { /// Note: The values stored within are [`UnsafeCell`]. /// Users of this API must ensure that accesses to each individual element /// adhere to the safety invariants of [`UnsafeCell`]. - /// - /// [`UnsafeCell`]: UnsafeCell #[inline] pub fn get_added_ticks_slice(&self) -> &[UnsafeCell] { &self.added_ticks @@ -334,8 +328,6 @@ impl Column { /// Note: The values stored within are [`UnsafeCell`]. /// Users of this API must ensure that accesses to each individual element /// adhere to the safety invariants of [`UnsafeCell`]. - /// - /// [`UnsafeCell`]: UnsafeCell #[inline] pub fn get_changed_ticks_slice(&self) -> &[UnsafeCell] { &self.changed_ticks @@ -411,8 +403,6 @@ impl Column { /// Note: The values stored within are [`UnsafeCell`]. /// Users of this API must ensure that accesses to each individual element /// adhere to the safety invariants of [`UnsafeCell`]. - /// - /// [`UnsafeCell`]: UnsafeCell #[inline] pub fn get_added_tick(&self, row: TableRow) -> Option<&UnsafeCell> { self.added_ticks.get(row.index()) @@ -425,8 +415,6 @@ impl Column { /// Note: The values stored within are [`UnsafeCell`]. /// Users of this API must ensure that accesses to each individual element /// adhere to the safety invariants of [`UnsafeCell`]. - /// - /// [`UnsafeCell`]: UnsafeCell #[inline] pub fn get_changed_tick(&self, row: TableRow) -> Option<&UnsafeCell> { self.changed_ticks.get(row.index()) diff --git a/crates/bevy_ecs/src/system/mod.rs b/crates/bevy_ecs/src/system/mod.rs index b2fced3650577..4bd91ea692a76 100644 --- a/crates/bevy_ecs/src/system/mod.rs +++ b/crates/bevy_ecs/src/system/mod.rs @@ -91,7 +91,6 @@ //! - [`EventWriter`](crate::event::EventWriter) //! - [`NonSend`] and `Option` //! - [`NonSendMut`] and `Option` -//! - [`&World`](World) //! - [`RemovedComponents`](crate::removal_detection::RemovedComponents) //! - [`SystemName`] //! - [`SystemChangeTick`] diff --git a/crates/bevy_ecs/src/system/system_param.rs b/crates/bevy_ecs/src/system/system_param.rs index 1e6dd707d452c..183368a4e1b35 100644 --- a/crates/bevy_ecs/src/system/system_param.rs +++ b/crates/bevy_ecs/src/system/system_param.rs @@ -403,7 +403,6 @@ impl_param_set!(); /// } /// ``` /// -/// [`SyncCell`]: SyncCell /// [`Exclusive`]: https://doc.rust-lang.org/nightly/std/sync/struct.Exclusive.html pub trait Resource: Send + Sync + 'static {} diff --git a/crates/bevy_reflect/src/list.rs b/crates/bevy_reflect/src/list.rs index 54d69e453ab36..8c0f03837c470 100644 --- a/crates/bevy_reflect/src/list.rs +++ b/crates/bevy_reflect/src/list.rs @@ -46,7 +46,6 @@ use crate::{ /// /// [list-like]: https://doc.rust-lang.org/book/ch08-01-vectors.html /// [reflection]: crate -/// [`Vec`]: Vec /// [type-erasing]: https://doc.rust-lang.org/book/ch17-02-trait-objects.html pub trait List: Reflect { /// Returns a reference to the element at `index`, or `None` if out of bounds. diff --git a/crates/bevy_reflect/src/map.rs b/crates/bevy_reflect/src/map.rs index f2d9adbf5b12e..3d4e8e58e6784 100644 --- a/crates/bevy_reflect/src/map.rs +++ b/crates/bevy_reflect/src/map.rs @@ -41,7 +41,6 @@ use crate::{ /// /// [map-like]: https://doc.rust-lang.org/book/ch08-03-hash-maps.html /// [reflection]: crate -/// [`HashMap`]: HashMap pub trait Map: Reflect { /// Returns a reference to the value associated with the given key. /// diff --git a/crates/bevy_reflect/src/serde/de.rs b/crates/bevy_reflect/src/serde/de.rs index 392ff6c33dd77..7108a5c953b1c 100644 --- a/crates/bevy_reflect/src/serde/de.rs +++ b/crates/bevy_reflect/src/serde/de.rs @@ -312,8 +312,6 @@ impl<'de> Visitor<'de> for U32Visitor { /// [`TypedReflectDeserializer`] may be used instead to avoid requiring these entries. /// /// [`Box`]: crate::Reflect -/// [`DynamicStruct`]: DynamicStruct -/// [`DynamicList`]: DynamicList /// [`FromReflect`]: crate::FromReflect /// [type path]: crate::TypePath::type_path pub struct UntypedReflectDeserializer<'a> { @@ -345,7 +343,6 @@ impl<'a, 'de> DeserializeSeed<'de> for UntypedReflectDeserializer<'a> { /// This deserializer expects a string containing the _full_ [type path] of the /// type to find the `TypeRegistration` of. /// -/// [`&TypeRegistration`]: TypeRegistration /// [type path]: crate::TypePath::type_path pub struct TypeRegistrationDeserializer<'a> { registry: &'a TypeRegistry, @@ -432,10 +429,7 @@ impl<'a, 'de> Visitor<'de> for UntypedReflectDeserializerVisitor<'a> { /// /// If the type is not known ahead of time, use [`UntypedReflectDeserializer`] instead. /// -/// [`TypeInfo`]: TypeInfo /// [`Box`]: crate::Reflect -/// [`DynamicStruct`]: DynamicStruct -/// [`DynamicList`]: DynamicList /// [`FromReflect`]: crate::FromReflect pub struct TypedReflectDeserializer<'a> { registration: &'a TypeRegistration, diff --git a/crates/bevy_reflect/src/type_info.rs b/crates/bevy_reflect/src/type_info.rs index 0e655adef1c8a..c5bcd34c714e6 100644 --- a/crates/bevy_reflect/src/type_info.rs +++ b/crates/bevy_reflect/src/type_info.rs @@ -97,7 +97,6 @@ pub trait Typed: Reflect + TypePath { /// /// [`Reflect::get_represented_type_info`]: Reflect::get_represented_type_info /// [`TypeRegistry::get_type_info`]: crate::TypeRegistry::get_type_info -/// [`TypeId`]: TypeId /// [type path]: TypePath::type_path #[derive(Debug, Clone)] pub enum TypeInfo { diff --git a/crates/bevy_reflect/src/type_registry.rs b/crates/bevy_reflect/src/type_registry.rs index 0f271eba3e526..ad32f5b7a2e70 100644 --- a/crates/bevy_reflect/src/type_registry.rs +++ b/crates/bevy_reflect/src/type_registry.rs @@ -167,7 +167,6 @@ impl TypeRegistry { /// /// If the specified type has not been registered, returns `None`. /// - /// [`TypeId`]: TypeId pub fn get(&self, type_id: TypeId) -> Option<&TypeRegistration> { self.registrations.get(&type_id) } @@ -177,7 +176,6 @@ impl TypeRegistry { /// /// If the specified type has not been registered, returns `None`. /// - /// [`TypeId`]: TypeId pub fn get_mut(&mut self, type_id: TypeId) -> Option<&mut TypeRegistration> { self.registrations.get_mut(&type_id) } @@ -335,7 +333,6 @@ impl Debug for TypeRegistration { impl TypeRegistration { /// Returns the [`TypeId`] of the type. /// - /// [`TypeId`]: TypeId #[inline] pub fn type_id(&self) -> TypeId { self.type_info.type_id() diff --git a/crates/bevy_render/src/camera/camera.rs b/crates/bevy_render/src/camera/camera.rs index 27ce9db052e13..a0a39e190ac1f 100644 --- a/crates/bevy_render/src/camera/camera.rs +++ b/crates/bevy_render/src/camera/camera.rs @@ -562,7 +562,6 @@ impl NormalizedRenderTarget { /// /// [`OrthographicProjection`]: crate::camera::OrthographicProjection /// [`PerspectiveProjection`]: crate::camera::PerspectiveProjection -/// [`Projection`]: Projection #[allow(clippy::too_many_arguments)] pub fn camera_system( mut window_resized_events: EventReader, diff --git a/crates/bevy_transform/src/components/transform.rs b/crates/bevy_transform/src/components/transform.rs index 3e1e79c5af637..316ee97719d7e 100644 --- a/crates/bevy_transform/src/components/transform.rs +++ b/crates/bevy_transform/src/components/transform.rs @@ -34,7 +34,6 @@ use std::ops::Mul; /// /// [`global_vs_local_translation`]: https://github.com/bevyengine/bevy/blob/latest/examples/transforms/global_vs_local_translation.rs /// [`transform`]: https://github.com/bevyengine/bevy/blob/latest/examples/transforms/transform.rs -/// [`Transform`]: Transform #[derive(Component, Debug, PartialEq, Clone, Copy, Reflect)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[reflect(Component, Default, PartialEq)] diff --git a/crates/bevy_utils/src/futures.rs b/crates/bevy_utils/src/futures.rs index 3c1137462cad5..07ce365be9bfe 100644 --- a/crates/bevy_utils/src/futures.rs +++ b/crates/bevy_utils/src/futures.rs @@ -1,6 +1,4 @@ //! Utilities for working with [`Future`]s. -//! -//! [`Future`]: Future use std::{ future::Future, pin::Pin, diff --git a/crates/bevy_utils/src/label.rs b/crates/bevy_utils/src/label.rs index 6a372a4f69e7f..b3197f4f54c4c 100644 --- a/crates/bevy_utils/src/label.rs +++ b/crates/bevy_utils/src/label.rs @@ -41,8 +41,6 @@ pub trait DynHash: DynEq { fn as_dyn_eq(&self) -> &dyn DynEq; /// Feeds this value into the given [`Hasher`]. - /// - /// [`Hasher`]: Hasher fn dyn_hash(&self, state: &mut dyn Hasher); } @@ -125,8 +123,6 @@ macro_rules! define_label { fn as_dyn_eq(&self) -> &dyn $crate::label::DynEq; /// Feeds this value into the given [`Hasher`]. - /// - /// [`Hasher`]: Hasher fn dyn_hash(&self, state: &mut dyn ::std::hash::Hasher); /// Returns an [`Interned`](bevy_utils::intern::Interned) value corresponding to `self`. From 2e84f1a7785a8a822dd2c3bc0b9079c0f197f867 Mon Sep 17 00:00:00 2001 From: tygyh Date: Tue, 28 Nov 2023 06:57:00 +0100 Subject: [PATCH 4/4] Readd required 'TypeRegistration' label --- crates/bevy_reflect/src/serde/de.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/bevy_reflect/src/serde/de.rs b/crates/bevy_reflect/src/serde/de.rs index 7108a5c953b1c..a1ceb885f2b56 100644 --- a/crates/bevy_reflect/src/serde/de.rs +++ b/crates/bevy_reflect/src/serde/de.rs @@ -343,6 +343,7 @@ impl<'a, 'de> DeserializeSeed<'de> for UntypedReflectDeserializer<'a> { /// This deserializer expects a string containing the _full_ [type path] of the /// type to find the `TypeRegistration` of. /// +/// [`&TypeRegistration`]: TypeRegistration /// [type path]: crate::TypePath::type_path pub struct TypeRegistrationDeserializer<'a> { registry: &'a TypeRegistry,