diff --git a/crates/bevy_asset/src/processor/mod.rs b/crates/bevy_asset/src/processor/mod.rs index a507ea654716b..b0724e4e17358 100644 --- a/crates/bevy_asset/src/processor/mod.rs +++ b/crates/bevy_asset/src/processor/mod.rs @@ -722,9 +722,7 @@ impl AssetProcessor { (meta, Some(processor)) } AssetActionMinimal::Ignore => { - let meta: Box = - Box::new(AssetMeta::<(), ()>::deserialize(&meta_bytes)?); - (meta, None) + return Ok(ProcessResult::Ignored); } }; (meta, meta_bytes, processor) @@ -1038,6 +1036,7 @@ impl AssetProcessorData { pub enum ProcessResult { Processed(ProcessedInfo), SkippedNotChanged, + Ignored, } /// The final status of processing an asset @@ -1185,6 +1184,9 @@ impl ProcessorAssetInfos { // "block until first pass finished" mode info.update_status(ProcessStatus::Processed).await; } + Ok(ProcessResult::Ignored) => { + debug!("Skipping processing (ignored) \"{:?}\"", asset_path); + } Err(ProcessError::ExtensionRequired) => { // Skip assets without extensions } diff --git a/crates/bevy_asset/src/server/loaders.rs b/crates/bevy_asset/src/server/loaders.rs index 05d2c4873ec37..fb161a986adb7 100644 --- a/crates/bevy_asset/src/server/loaders.rs +++ b/crates/bevy_asset/src/server/loaders.rs @@ -307,12 +307,16 @@ mod tests { use super::*; + // The compiler notices these fields are never read and raises a dead_code lint which kill CI. + #[allow(dead_code)] #[derive(Asset, TypePath, Debug)] struct A(usize); + #[allow(dead_code)] #[derive(Asset, TypePath, Debug)] struct B(usize); + #[allow(dead_code)] #[derive(Asset, TypePath, Debug)] struct C(usize); diff --git a/crates/bevy_ecs/src/lib.rs b/crates/bevy_ecs/src/lib.rs index 17c5693d59269..245e2bcd64786 100644 --- a/crates/bevy_ecs/src/lib.rs +++ b/crates/bevy_ecs/src/lib.rs @@ -84,6 +84,7 @@ mod tests { #[derive(Component, Debug, PartialEq, Eq, Clone, Copy)] struct C; + #[allow(dead_code)] #[derive(Default)] struct NonSendA(usize, PhantomData<*mut ()>); @@ -102,6 +103,8 @@ mod tests { } } + // TODO: The compiler says the Debug and Clone are removed during dead code analysis. Investigate. + #[allow(dead_code)] #[derive(Component, Clone, Debug)] #[component(storage = "SparseSet")] struct DropCkSparse(DropCk); @@ -1724,9 +1727,12 @@ mod tests { ); } + // These fields are never read so we get a dead code lint here. + #[allow(dead_code)] #[derive(Component)] struct ComponentA(u32); + #[allow(dead_code)] #[derive(Component)] struct ComponentB(u32); diff --git a/crates/bevy_ecs/src/system/commands/mod.rs b/crates/bevy_ecs/src/system/commands/mod.rs index a8d7fe9cc3116..acf5e39f683fa 100644 --- a/crates/bevy_ecs/src/system/commands/mod.rs +++ b/crates/bevy_ecs/src/system/commands/mod.rs @@ -1092,6 +1092,7 @@ mod tests { Arc, }; + #[allow(dead_code)] #[derive(Component)] #[component(storage = "SparseSet")] struct SparseDropCk(DropCk); diff --git a/crates/bevy_ecs/src/system/mod.rs b/crates/bevy_ecs/src/system/mod.rs index 775163f4fc2b9..19785a7243c75 100644 --- a/crates/bevy_ecs/src/system/mod.rs +++ b/crates/bevy_ecs/src/system/mod.rs @@ -844,7 +844,9 @@ mod tests { let mut world = World::default(); world.insert_resource(SystemRan::No); + #[allow(dead_code)] struct NotSend1(std::rc::Rc); + #[allow(dead_code)] struct NotSend2(std::rc::Rc); world.insert_non_send_resource(NotSend1(std::rc::Rc::new(0))); @@ -867,7 +869,9 @@ mod tests { let mut world = World::default(); world.insert_resource(SystemRan::No); + #[allow(dead_code)] struct NotSend1(std::rc::Rc); + #[allow(dead_code)] struct NotSend2(std::rc::Rc); world.insert_non_send_resource(NotSend1(std::rc::Rc::new(1))); diff --git a/crates/bevy_ecs/src/system/system_param.rs b/crates/bevy_ecs/src/system/system_param.rs index 7b9d7cfd1349a..eabe8d5d19983 100644 --- a/crates/bevy_ecs/src/system/system_param.rs +++ b/crates/bevy_ecs/src/system/system_param.rs @@ -1578,6 +1578,7 @@ mod tests { // Compile test for https://github.com/bevyengine/bevy/pull/7001. #[test] fn system_param_const_generics() { + #[allow(dead_code)] #[derive(SystemParam)] pub struct ConstGenericParam<'w, const I: usize>(Res<'w, R>); @@ -1635,6 +1636,7 @@ mod tests { #[derive(SystemParam)] pub struct UnitParam; + #[allow(dead_code)] #[derive(SystemParam)] pub struct TupleParam<'w, 's, R: Resource, L: FromWorld + Send + 'static>( Res<'w, R>, @@ -1651,6 +1653,7 @@ mod tests { #[derive(Resource)] struct PrivateResource; + #[allow(dead_code)] #[derive(SystemParam)] pub struct EncapsulatedParam<'w>(Res<'w, PrivateResource>); diff --git a/crates/bevy_ecs/src/world/command_queue.rs b/crates/bevy_ecs/src/world/command_queue.rs index 3103e3486ce2d..27ac752139639 100644 --- a/crates/bevy_ecs/src/world/command_queue.rs +++ b/crates/bevy_ecs/src/world/command_queue.rs @@ -344,6 +344,7 @@ mod test { // This has an arbitrary value `String` stored to ensure // when then command gets pushed, the `bytes` vector gets // some data added to it. + #[allow(dead_code)] struct PanicCommand(String); impl Command for PanicCommand { fn apply(self, _: &mut World) { @@ -392,6 +393,7 @@ mod test { assert_is_send(SpawnCommand); } + #[allow(dead_code)] struct CommandWithPadding(u8, u16); impl Command for CommandWithPadding { fn apply(self, _: &mut World) {} diff --git a/crates/bevy_ecs_compile_fail_tests/tests/ui/query_exact_sized_iterator_safety.stderr b/crates/bevy_ecs_compile_fail_tests/tests/ui/query_exact_sized_iterator_safety.stderr index e4c9574ad49d2..ddc1c9e78a91b 100644 --- a/crates/bevy_ecs_compile_fail_tests/tests/ui/query_exact_sized_iterator_safety.stderr +++ b/crates/bevy_ecs_compile_fail_tests/tests/ui/query_exact_sized_iterator_safety.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `bevy_ecs::query::Changed: ArchetypeFilter` i --> tests/ui/query_exact_sized_iterator_safety.rs:8:28 | 8 | is_exact_size_iterator(query.iter()); - | ---------------------- ^^^^^^^^^^^^ the trait `ArchetypeFilter` is not implemented for `bevy_ecs::query::Changed` + | ---------------------- ^^^^^^^^^^^^ the trait `ArchetypeFilter` is not implemented for `bevy_ecs::query::Changed`, which is required by `QueryIter<'_, '_, &Foo, bevy_ecs::query::Changed>: ExactSizeIterator` | | | required by a bound introduced by this call | @@ -27,7 +27,7 @@ error[E0277]: the trait bound `bevy_ecs::query::Added: ArchetypeFilter` is --> tests/ui/query_exact_sized_iterator_safety.rs:13:28 | 13 | is_exact_size_iterator(query.iter()); - | ---------------------- ^^^^^^^^^^^^ the trait `ArchetypeFilter` is not implemented for `bevy_ecs::query::Added` + | ---------------------- ^^^^^^^^^^^^ the trait `ArchetypeFilter` is not implemented for `bevy_ecs::query::Added`, which is required by `QueryIter<'_, '_, &Foo, bevy_ecs::query::Added>: ExactSizeIterator` | | | required by a bound introduced by this call | diff --git a/crates/bevy_ecs_compile_fail_tests/tests/ui/query_iter_combinations_mut_iterator_safety.stderr b/crates/bevy_ecs_compile_fail_tests/tests/ui/query_iter_combinations_mut_iterator_safety.stderr index a2059f29b57ce..b005ce76291d1 100644 --- a/crates/bevy_ecs_compile_fail_tests/tests/ui/query_iter_combinations_mut_iterator_safety.stderr +++ b/crates/bevy_ecs_compile_fail_tests/tests/ui/query_iter_combinations_mut_iterator_safety.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `&mut A: ReadOnlyQueryData` is not satisfied --> tests/ui/query_iter_combinations_mut_iterator_safety.rs:10:17 | 10 | is_iterator(iter) - | ----------- ^^^^ the trait `ReadOnlyQueryData` is not implemented for `&mut A` + | ----------- ^^^^ the trait `ReadOnlyQueryData` is not implemented for `&mut A`, which is required by `QueryCombinationIter<'_, '_, &mut A, (), _>: Iterator` | | | required by a bound introduced by this call | diff --git a/crates/bevy_ecs_compile_fail_tests/tests/ui/query_iter_many_mut_iterator_safety.stderr b/crates/bevy_ecs_compile_fail_tests/tests/ui/query_iter_many_mut_iterator_safety.stderr index 959e4d126eedd..d8f8d91855b8a 100644 --- a/crates/bevy_ecs_compile_fail_tests/tests/ui/query_iter_many_mut_iterator_safety.stderr +++ b/crates/bevy_ecs_compile_fail_tests/tests/ui/query_iter_many_mut_iterator_safety.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `&mut A: ReadOnlyQueryData` is not satisfied --> tests/ui/query_iter_many_mut_iterator_safety.rs:10:17 | 10 | is_iterator(iter) - | ----------- ^^^^ the trait `ReadOnlyQueryData` is not implemented for `&mut A` + | ----------- ^^^^ the trait `ReadOnlyQueryData` is not implemented for `&mut A`, which is required by `QueryManyIter<'_, '_, &mut A, (), std::array::IntoIter>: Iterator` | | | required by a bound introduced by this call | diff --git a/crates/bevy_ecs_compile_fail_tests/tests/ui/system_param_derive_readonly.stderr b/crates/bevy_ecs_compile_fail_tests/tests/ui/system_param_derive_readonly.stderr index 49120c73bb565..dab85816fd6ea 100644 --- a/crates/bevy_ecs_compile_fail_tests/tests/ui/system_param_derive_readonly.stderr +++ b/crates/bevy_ecs_compile_fail_tests/tests/ui/system_param_derive_readonly.stderr @@ -10,7 +10,7 @@ error[E0277]: the trait bound `&'static mut Foo: ReadOnlyQueryData` is not satis --> tests/ui/system_param_derive_readonly.rs:18:23 | 18 | assert_readonly::(); - | ^^^^^^^ the trait `ReadOnlyQueryData` is not implemented for `&'static mut Foo` + | ^^^^^^^ the trait `ReadOnlyQueryData` is not implemented for `&'static mut Foo`, which is required by `Mutable<'_, '_>: ReadOnlySystemParam` | = help: the following other types implement trait `ReadOnlyQueryData`: bevy_ecs::change_detection::Ref<'__w, T> diff --git a/crates/bevy_hierarchy/src/child_builder.rs b/crates/bevy_hierarchy/src/child_builder.rs index f8d206dee5580..9f36fe679e962 100644 --- a/crates/bevy_hierarchy/src/child_builder.rs +++ b/crates/bevy_hierarchy/src/child_builder.rs @@ -851,6 +851,7 @@ mod tests { ); } + #[allow(dead_code)] #[derive(Component)] struct C(u32); diff --git a/crates/bevy_macros_compile_fail_tests/tests/deref_mut_derive/missing_deref.fail.stderr b/crates/bevy_macros_compile_fail_tests/tests/deref_mut_derive/missing_deref.fail.stderr index 3e11d49532e94..c969892c67ee8 100644 --- a/crates/bevy_macros_compile_fail_tests/tests/deref_mut_derive/missing_deref.fail.stderr +++ b/crates/bevy_macros_compile_fail_tests/tests/deref_mut_derive/missing_deref.fail.stderr @@ -7,6 +7,14 @@ error[E0277]: the trait bound `TupleStruct: Deref` is not satisfied note: required by a bound in `DerefMut` --> $RUST/core/src/ops/deref.rs +error[E0277]: the trait bound `TupleStruct: Deref` is not satisfied + --> tests/deref_mut_derive/missing_deref.fail.rs:3:10 + | +3 | #[derive(DerefMut)] + | ^^^^^^^^ the trait `Deref` is not implemented for `TupleStruct` + | + = note: this error originates in the derive macro `DerefMut` (in Nightly builds, run with -Z macro-backtrace for more info) + error[E0277]: the trait bound `Struct: Deref` is not satisfied --> tests/deref_mut_derive/missing_deref.fail.rs:7:8 | @@ -16,14 +24,6 @@ error[E0277]: the trait bound `Struct: Deref` is not satisfied note: required by a bound in `DerefMut` --> $RUST/core/src/ops/deref.rs -error[E0277]: the trait bound `TupleStruct: Deref` is not satisfied - --> tests/deref_mut_derive/missing_deref.fail.rs:3:10 - | -3 | #[derive(DerefMut)] - | ^^^^^^^^ the trait `Deref` is not implemented for `TupleStruct` - | - = note: this error originates in the derive macro `DerefMut` (in Nightly builds, run with -Z macro-backtrace for more info) - error[E0277]: the trait bound `Struct: Deref` is not satisfied --> tests/deref_mut_derive/missing_deref.fail.rs:6:10 | diff --git a/crates/bevy_reflect_compile_fail_tests/tests/reflect_derive/generics.fail.stderr b/crates/bevy_reflect_compile_fail_tests/tests/reflect_derive/generics.fail.stderr index 22a6cc8d53ccf..3f1dca9e6a20f 100644 --- a/crates/bevy_reflect_compile_fail_tests/tests/reflect_derive/generics.fail.stderr +++ b/crates/bevy_reflect_compile_fail_tests/tests/reflect_derive/generics.fail.stderr @@ -26,7 +26,7 @@ error[E0277]: the trait bound `NoReflect: GetTypeRegistration` is not satisfied --> tests/reflect_derive/generics.fail.rs:14:36 | 14 | let mut foo: Box = Box::new(Foo:: { a: NoReflect(42.0) }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `GetTypeRegistration` is not implemented for `NoReflect` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `GetTypeRegistration` is not implemented for `NoReflect`, which is required by `Foo: bevy_reflect::Struct` | = help: the following other types implement trait `GetTypeRegistration`: bool diff --git a/crates/bevy_winit/src/lib.rs b/crates/bevy_winit/src/lib.rs index 9992178a78114..a50ecdf0c55e8 100644 --- a/crates/bevy_winit/src/lib.rs +++ b/crates/bevy_winit/src/lib.rs @@ -770,8 +770,8 @@ fn run_app_update_if_should( UpdateMode::Reactive { wait } | UpdateMode::ReactiveLowPower { wait } => { // TODO(bug): this is unexpected behavior. // When Reactive, user expects bevy to actually wait that amount of time, - // and not potentially infinitely depending on plateform specifics (which this does) - // Need to verify the plateform specifics (whether this can occur in + // and not potentially infinitely depending on platform specifics (which this does) + // Need to verify the platform specifics (whether this can occur in // rare-but-possible cases) and replace this with a panic or a log warn! if let Some(next) = runner_state.last_update.checked_add(*wait) { event_loop.set_control_flow(ControlFlow::WaitUntil(next)); diff --git a/crates/bevy_winit/src/winit_windows.rs b/crates/bevy_winit/src/winit_windows.rs index ff7d798d4bf33..de589a74543a4 100644 --- a/crates/bevy_winit/src/winit_windows.rs +++ b/crates/bevy_winit/src/winit_windows.rs @@ -107,7 +107,7 @@ impl WinitWindows { #[cfg(target_os = "windows")] { use winit::platform::windows::WindowBuilderExtWindows; - winit_window_builder = winit_window_builder.with_skip_taskbar(window.skip_taskbar) + winit_window_builder = winit_window_builder.with_skip_taskbar(window.skip_taskbar); } #[cfg(any( diff --git a/examples/ui/borders.rs b/examples/ui/borders.rs index 3c8b49743eadf..fb4e413046a72 100644 --- a/examples/ui/borders.rs +++ b/examples/ui/borders.rs @@ -28,7 +28,28 @@ fn setup(mut commands: Commands) { }) .id(); + // labels for the different border edges + let border_labels = [ + "None", + "All", + "Left", + "Right", + "Top", + "Bottom", + "Left Right", + "Top Bottom", + "Top Left", + "Bottom Left", + "Top Right", + "Bottom Right", + "Top Bottom Right", + "Top Bottom Left", + "Top Left Right", + "Bottom Left Right", + ]; + // all the different combinations of border edges + // these correspond to the labels above let borders = [ UiRect::default(), UiRect::all(Val::Px(10.)), @@ -84,7 +105,7 @@ fn setup(mut commands: Commands) { }, ]; - for i in 0..64 { + for (label, border) in border_labels.into_iter().zip(borders) { let inner_spot = commands .spawn(NodeBundle { style: Style { @@ -96,13 +117,13 @@ fn setup(mut commands: Commands) { ..Default::default() }) .id(); - let bordered_node = commands + let border_node = commands .spawn(( NodeBundle { style: Style { width: Val::Px(50.), height: Val::Px(50.), - border: borders[i % borders.len()], + border, margin: UiRect::all(Val::Px(20.)), align_items: AlignItems::Center, justify_content: JustifyContent::Center, @@ -120,6 +141,26 @@ fn setup(mut commands: Commands) { )) .add_child(inner_spot) .id(); - commands.entity(root).add_child(bordered_node); + let label_node = commands + .spawn(TextBundle::from_section( + label, + TextStyle { + font_size: 9.0, + ..Default::default() + }, + )) + .id(); + let container = commands + .spawn(NodeBundle { + style: Style { + flex_direction: FlexDirection::Column, + align_items: AlignItems::Center, + ..Default::default() + }, + ..Default::default() + }) + .push_children(&[border_node, label_node]) + .id(); + commands.entity(root).add_child(container); } }