From a788e31ad55861f9bf4423ca179b8445f0864001 Mon Sep 17 00:00:00 2001 From: Rob Parrett Date: Fri, 25 Aug 2023 05:34:24 -0700 Subject: [PATCH] Fix CI for Rust 1.72 (#9562) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Objective [Rust 1.72.0](https://blog.rust-lang.org/2023/08/24/Rust-1.72.0.html) is now stable. # Notes - `let-else` formatting has arrived! - I chose to allow `explicit_iter_loop` due to https://github.com/rust-lang/rust-clippy/issues/11074. We didn't hit any of the false positives that prevent compilation, but fixing this did produce a lot of the "symbol soup" mentioned, e.g. `for image in &mut *image_events {`. Happy to undo this if there's consensus the other way. --------- Co-authored-by: François --- crates/bevy_animation/src/lib.rs | 16 +++++++--- crates/bevy_asset/src/asset_server.rs | 14 +++++--- crates/bevy_asset/src/io/file_asset_io.rs | 4 ++- crates/bevy_core_pipeline/src/blit/mod.rs | 2 +- crates/bevy_core_pipeline/src/bloom/mod.rs | 5 ++- .../src/contrast_adaptive_sharpening/node.rs | 9 ++++-- .../bevy_core_pipeline/src/msaa_writeback.rs | 2 +- crates/bevy_core_pipeline/src/taa/mod.rs | 14 ++++---- crates/bevy_ecs/macros/src/fetch.rs | 2 +- crates/bevy_ecs/macros/src/lib.rs | 15 ++++++--- crates/bevy_ecs/src/schedule/schedule.rs | 4 +-- crates/bevy_ecs/src/schedule/set.rs | 2 +- crates/bevy_ecs/src/world/mod.rs | 5 +-- .../query_exact_sized_iterator_safety.stderr | 32 +++++++++---------- ...er_combinations_mut_iterator_safety.stderr | 16 +++++----- ...query_iter_many_mut_iterator_safety.stderr | 16 +++++----- .../ui/system_param_derive_readonly.stderr | 16 +++++----- .../tests/ui/world_query_derive.stderr | 32 +++++++++---------- crates/bevy_gizmos/src/gizmos.rs | 2 +- crates/bevy_gizmos/src/lib.rs | 8 +++-- crates/bevy_gizmos/src/pipeline_2d.rs | 12 +++++-- crates/bevy_gizmos/src/pipeline_3d.rs | 12 +++++-- crates/bevy_math/src/cubic_splines.rs | 5 +-- crates/bevy_pbr/src/prepass/mod.rs | 4 ++- crates/bevy_pbr/src/ssao/mod.rs | 11 +++++-- .../bevy_reflect_derive/src/derive_data.rs | 6 ++-- crates/bevy_reflect/src/map.rs | 2 +- crates/bevy_reflect/src/struct_trait.rs | 2 +- .../tests/reflect_derive/generics.fail.stderr | 16 +++++----- crates/bevy_render/src/color/mod.rs | 12 +++++-- crates/bevy_render/src/mesh/morph.rs | 7 ++-- crates/bevy_render/src/pipelined_rendering.rs | 4 ++- crates/bevy_render/src/render_graph/graph.rs | 4 ++- crates/bevy_render/src/render_graph/node.rs | 7 ++-- crates/bevy_ui/src/render/render_pass.rs | 8 ++--- crates/bevy_winit/src/lib.rs | 24 +++++++------- examples/2d/texture_atlas.rs | 5 ++- examples/3d/bloom_3d.rs | 2 +- examples/animation/morph_targets.rs | 8 +++-- examples/games/breakout.rs | 5 --- examples/shader/post_processing.rs | 3 +- examples/shader/texture_binding_array.rs | 2 +- examples/stress_tests/many_gizmos.rs | 5 ++- .../tools/scene_viewer/morph_viewer_plugin.rs | 8 +++-- examples/ui/overflow_debug.rs | 2 +- tools/ci/src/main.rs | 2 +- 46 files changed, 235 insertions(+), 159 deletions(-) diff --git a/crates/bevy_animation/src/lib.rs b/crates/bevy_animation/src/lib.rs index b7b8cb1a49..b84e871f04 100644 --- a/crates/bevy_animation/src/lib.rs +++ b/crates/bevy_animation/src/lib.rs @@ -341,9 +341,13 @@ fn verify_no_ancestor_player( player_parent: Option<&Parent>, parents: &Query<(Option>, Option<&Parent>)>, ) -> bool { - let Some(mut current) = player_parent.map(Parent::get) else { return true }; + let Some(mut current) = player_parent.map(Parent::get) else { + return true; + }; loop { - let Ok((maybe_player, parent)) = parents.get(current) else { return true }; + let Ok((maybe_player, parent)) = parents.get(current) else { + return true; + }; if maybe_player.is_some() { return false; } @@ -506,7 +510,9 @@ fn apply_animation( for (path, bone_id) in &animation_clip.paths { let cached_path = &mut animation.path_cache[*bone_id]; let curves = animation_clip.get_curves(*bone_id).unwrap(); - let Some(target) = entity_from_path(root, path, children, names, cached_path) else { continue }; + let Some(target) = entity_from_path(root, path, children, names, cached_path) else { + continue; + }; // SAFETY: The verify_no_ancestor_player check above ensures that two animation players cannot alias // any of their descendant Transforms. // @@ -519,7 +525,9 @@ fn apply_animation( // This means only the AnimationPlayers closest to the root of the hierarchy will be able // to run their animation. Any players in the children or descendants will log a warning // and do nothing. - let Ok(mut transform) = (unsafe { transforms.get_unchecked(target) }) else { continue }; + let Ok(mut transform) = (unsafe { transforms.get_unchecked(target) }) else { + continue; + }; let mut morphs = unsafe { morphs.get_unchecked(target) }; for curve in curves { // Some curves have only one keyframe used to set a transform diff --git a/crates/bevy_asset/src/asset_server.rs b/crates/bevy_asset/src/asset_server.rs index e5daf11126..11dbd21b37 100644 --- a/crates/bevy_asset/src/asset_server.rs +++ b/crates/bevy_asset/src/asset_server.rs @@ -790,7 +790,8 @@ mod test { let asset_server = setup("."); asset_server.add_loader(FakePngLoader); - let Ok(MaybeAssetLoader::Ready(t)) = asset_server.get_path_asset_loader("test.png", true) else { + let Ok(MaybeAssetLoader::Ready(t)) = asset_server.get_path_asset_loader("test.png", true) + else { panic!(); }; @@ -802,7 +803,8 @@ mod test { let asset_server = setup("."); asset_server.add_loader(FakePngLoader); - let Ok(MaybeAssetLoader::Ready(t)) = asset_server.get_path_asset_loader("test.PNG", true) else { + let Ok(MaybeAssetLoader::Ready(t)) = asset_server.get_path_asset_loader("test.PNG", true) + else { panic!(); }; assert_eq!(t.extensions()[0], "png"); @@ -855,7 +857,9 @@ mod test { let asset_server = setup("."); asset_server.add_loader(FakePngLoader); - let Ok(MaybeAssetLoader::Ready(t)) = asset_server.get_path_asset_loader("test-v1.2.3.png", true) else { + let Ok(MaybeAssetLoader::Ready(t)) = + asset_server.get_path_asset_loader("test-v1.2.3.png", true) + else { panic!(); }; assert_eq!(t.extensions()[0], "png"); @@ -866,7 +870,9 @@ mod test { let asset_server = setup("."); asset_server.add_loader(FakeMultipleDotLoader); - let Ok(MaybeAssetLoader::Ready(t)) = asset_server.get_path_asset_loader("test.test.png", true) else { + let Ok(MaybeAssetLoader::Ready(t)) = + asset_server.get_path_asset_loader("test.test.png", true) + else { panic!(); }; assert_eq!(t.extensions()[0], "test.png"); diff --git a/crates/bevy_asset/src/io/file_asset_io.rs b/crates/bevy_asset/src/io/file_asset_io.rs index 9dabb1b1b5..1c4f56f28a 100644 --- a/crates/bevy_asset/src/io/file_asset_io.rs +++ b/crates/bevy_asset/src/io/file_asset_io.rs @@ -201,7 +201,9 @@ pub fn filesystem_watcher_system( } = event { for path in &paths { - let Some(set) = watcher.path_map.get(path) else {continue}; + let Some(set) = watcher.path_map.get(path) else { + continue; + }; for to_reload in set { // When an asset is modified, note down the timestamp (overriding any previous modification events) changed.insert(to_reload.to_owned(), Instant::now()); diff --git a/crates/bevy_core_pipeline/src/blit/mod.rs b/crates/bevy_core_pipeline/src/blit/mod.rs index 2bc2f63ea9..98442953bd 100644 --- a/crates/bevy_core_pipeline/src/blit/mod.rs +++ b/crates/bevy_core_pipeline/src/blit/mod.rs @@ -19,7 +19,7 @@ impl Plugin for BlitPlugin { fn finish(&self, app: &mut App) { let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { - return + return; }; render_app diff --git a/crates/bevy_core_pipeline/src/bloom/mod.rs b/crates/bevy_core_pipeline/src/bloom/mod.rs index e5271544e2..5ec42d0c2e 100644 --- a/crates/bevy_core_pipeline/src/bloom/mod.rs +++ b/crates/bevy_core_pipeline/src/bloom/mod.rs @@ -163,7 +163,10 @@ impl ViewNode for BloomNode { pipeline_cache.get_render_pipeline(downsampling_pipeline_ids.main), pipeline_cache.get_render_pipeline(upsampling_pipeline_ids.id_main), pipeline_cache.get_render_pipeline(upsampling_pipeline_ids.id_final), - ) else { return Ok(()) }; + ) + else { + return Ok(()); + }; render_context.command_encoder().push_debug_group("bloom"); diff --git a/crates/bevy_core_pipeline/src/contrast_adaptive_sharpening/node.rs b/crates/bevy_core_pipeline/src/contrast_adaptive_sharpening/node.rs index c49d876f22..0dd3f086ee 100644 --- a/crates/bevy_core_pipeline/src/contrast_adaptive_sharpening/node.rs +++ b/crates/bevy_core_pipeline/src/contrast_adaptive_sharpening/node.rs @@ -53,10 +53,15 @@ impl Node for CASNode { let sharpening_pipeline = world.resource::(); let uniforms = world.resource::>(); - let Ok((target, pipeline, uniform_index)) = self.query.get_manual(world, view_entity) else { return Ok(()) }; + let Ok((target, pipeline, uniform_index)) = self.query.get_manual(world, view_entity) + else { + return Ok(()); + }; let uniforms_id = uniforms.buffer().unwrap().id(); - let Some(uniforms) = uniforms.binding() else { return Ok(()) }; + let Some(uniforms) = uniforms.binding() else { + return Ok(()); + }; let pipeline = pipeline_cache.get_render_pipeline(pipeline.0).unwrap(); diff --git a/crates/bevy_core_pipeline/src/msaa_writeback.rs b/crates/bevy_core_pipeline/src/msaa_writeback.rs index cf881b07b6..cd925c3722 100644 --- a/crates/bevy_core_pipeline/src/msaa_writeback.rs +++ b/crates/bevy_core_pipeline/src/msaa_writeback.rs @@ -21,7 +21,7 @@ pub struct MsaaWritebackPlugin; impl Plugin for MsaaWritebackPlugin { fn build(&self, app: &mut App) { let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { - return + return; }; render_app.add_systems( diff --git a/crates/bevy_core_pipeline/src/taa/mod.rs b/crates/bevy_core_pipeline/src/taa/mod.rs index 01e75ddd15..66097d3bee 100644 --- a/crates/bevy_core_pipeline/src/taa/mod.rs +++ b/crates/bevy_core_pipeline/src/taa/mod.rs @@ -57,7 +57,9 @@ impl Plugin for TemporalAntiAliasPlugin { app.insert_resource(Msaa::Off) .register_type::(); - let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { return }; + let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { + return; + }; render_app .init_resource::>() @@ -86,7 +88,9 @@ impl Plugin for TemporalAntiAliasPlugin { } fn finish(&self, app: &mut App) { - let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { return }; + let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { + return; + }; render_app.init_resource::(); } @@ -188,11 +192,7 @@ impl ViewNode for TAANode { ) else { return Ok(()); }; - let ( - Some(taa_pipeline), - Some(prepass_motion_vectors_texture), - Some(prepass_depth_texture), - ) = ( + let (Some(taa_pipeline), Some(prepass_motion_vectors_texture), Some(prepass_depth_texture)) = ( pipeline_cache.get_render_pipeline(taa_pipeline_id.0), &prepass_textures.motion_vectors, &prepass_textures.depth, diff --git a/crates/bevy_ecs/macros/src/fetch.rs b/crates/bevy_ecs/macros/src/fetch.rs index 987ee67dc4..e28d33475b 100644 --- a/crates/bevy_ecs/macros/src/fetch.rs +++ b/crates/bevy_ecs/macros/src/fetch.rs @@ -135,7 +135,7 @@ pub fn derive_world_query_impl(input: TokenStream) -> TokenStream { "#[derive(WorldQuery)]` only supports structs", ) .into_compile_error() - .into() + .into(); }; let mut field_attrs = Vec::new(); diff --git a/crates/bevy_ecs/macros/src/lib.rs b/crates/bevy_ecs/macros/src/lib.rs index 110df68260..5bfbb3cfee 100644 --- a/crates/bevy_ecs/macros/src/lib.rs +++ b/crates/bevy_ecs/macros/src/lib.rs @@ -251,10 +251,17 @@ pub fn impl_param_set(_input: TokenStream) -> TokenStream { pub fn derive_system_param(input: TokenStream) -> TokenStream { let token_stream = input.clone(); let ast = parse_macro_input!(input as DeriveInput); - let syn::Data::Struct(syn::DataStruct { fields: field_definitions, .. }) = ast.data else { - return syn::Error::new(ast.span(), "Invalid `SystemParam` type: expected a `struct`") - .into_compile_error() - .into(); + let syn::Data::Struct(syn::DataStruct { + fields: field_definitions, + .. + }) = ast.data + else { + return syn::Error::new( + ast.span(), + "Invalid `SystemParam` type: expected a `struct`", + ) + .into_compile_error() + .into(); }; let path = bevy_ecs_path(); diff --git a/crates/bevy_ecs/src/schedule/schedule.rs b/crates/bevy_ecs/src/schedule/schedule.rs index cb9ab0a978..4f1b90ff90 100644 --- a/crates/bevy_ecs/src/schedule/schedule.rs +++ b/crates/bevy_ecs/src/schedule/schedule.rs @@ -550,8 +550,8 @@ impl ScheduleGraph { let Some(prev) = config_iter.next() else { return AddSystemsInnerResult { nodes: Vec::new(), - densely_chained: true - } + densely_chained: true, + }; }; let mut previous_result = self.add_systems_inner(prev, true); densely_chained = previous_result.densely_chained; diff --git a/crates/bevy_ecs/src/schedule/set.rs b/crates/bevy_ecs/src/schedule/set.rs index c34745b9f3..6e0caaba09 100644 --- a/crates/bevy_ecs/src/schedule/set.rs +++ b/crates/bevy_ecs/src/schedule/set.rs @@ -83,7 +83,7 @@ impl Hash for SystemTypeSet { } impl Clone for SystemTypeSet { fn clone(&self) -> Self { - Self(PhantomData) + *self } } diff --git a/crates/bevy_ecs/src/world/mod.rs b/crates/bevy_ecs/src/world/mod.rs index 82f2456b58..0e79b19ce8 100644 --- a/crates/bevy_ecs/src/world/mod.rs +++ b/crates/bevy_ecs/src/world/mod.rs @@ -1770,8 +1770,9 @@ impl World { f: impl FnOnce(&mut World, &mut Schedule) -> R, ) -> Result { let label = label.as_ref(); - let Some((extracted_label, mut schedule)) - = self.get_resource_mut::().and_then(|mut s| s.remove_entry(label)) + let Some((extracted_label, mut schedule)) = self + .get_resource_mut::() + .and_then(|mut s| s.remove_entry(label)) else { return Err(TryRunScheduleError(label.dyn_clone())); }; 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 ad2d61d015..e4c9574ad4 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 @@ -7,14 +7,14 @@ error[E0277]: the trait bound `bevy_ecs::query::Changed: ArchetypeFilter` i | required by a bound introduced by this call | = help: the following other types implement trait `ArchetypeFilter`: - () - (F0, F1) - (F0, F1, F2) - (F0, F1, F2, F3) - (F0, F1, F2, F3, F4) - (F0, F1, F2, F3, F4, F5) - (F0, F1, F2, F3, F4, F5, F6) - (F0, F1, F2, F3, F4, F5, F6, F7) + With + Without + Or<()> + Or<(F0,)> + Or<(F0, F1)> + Or<(F0, F1, F2)> + Or<(F0, F1, F2, F3)> + Or<(F0, F1, F2, F3, F4)> and $N others = note: required for `QueryIter<'_, '_, &Foo, bevy_ecs::query::Changed>` to implement `ExactSizeIterator` note: required by a bound in `is_exact_size_iterator` @@ -32,14 +32,14 @@ error[E0277]: the trait bound `bevy_ecs::query::Added: ArchetypeFilter` is | required by a bound introduced by this call | = help: the following other types implement trait `ArchetypeFilter`: - () - (F0, F1) - (F0, F1, F2) - (F0, F1, F2, F3) - (F0, F1, F2, F3, F4) - (F0, F1, F2, F3, F4, F5) - (F0, F1, F2, F3, F4, F5, F6) - (F0, F1, F2, F3, F4, F5, F6, F7) + With + Without + Or<()> + Or<(F0,)> + Or<(F0, F1)> + Or<(F0, F1, F2)> + Or<(F0, F1, F2, F3)> + Or<(F0, F1, F2, F3, F4)> and $N others = note: required for `QueryIter<'_, '_, &Foo, bevy_ecs::query::Added>` to implement `ExactSizeIterator` note: required by a bound in `is_exact_size_iterator` 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 0b1474d289..570cab0a54 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 @@ -7,14 +7,14 @@ error[E0277]: the trait bound `&mut A: ReadOnlyWorldQuery` is not satisfied | required by a bound introduced by this call | = help: the following other types implement trait `ReadOnlyWorldQuery`: - &T - () - (F0, F1) - (F0, F1, F2) - (F0, F1, F2, F3) - (F0, F1, F2, F3, F4) - (F0, F1, F2, F3, F4, F5) - (F0, F1, F2, F3, F4, F5, F6) + bevy_ecs::change_detection::Ref<'__w, T> + Has + AnyOf<()> + AnyOf<(F0,)> + AnyOf<(F0, F1)> + AnyOf<(F0, F1, F2)> + AnyOf<(F0, F1, F2, F3)> + AnyOf<(F0, F1, F2, F3, F4)> and $N others = note: `ReadOnlyWorldQuery` is implemented for `&A`, but not for `&mut A` = note: required for `QueryCombinationIter<'_, '_, &mut A, (), _>` to implement `Iterator` 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 855f36173d..6fa4ef005c 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 @@ -7,14 +7,14 @@ error[E0277]: the trait bound `&mut A: ReadOnlyWorldQuery` is not satisfied | required by a bound introduced by this call | = help: the following other types implement trait `ReadOnlyWorldQuery`: - &T - () - (F0, F1) - (F0, F1, F2) - (F0, F1, F2, F3) - (F0, F1, F2, F3, F4) - (F0, F1, F2, F3, F4, F5) - (F0, F1, F2, F3, F4, F5, F6) + bevy_ecs::change_detection::Ref<'__w, T> + Has + AnyOf<()> + AnyOf<(F0,)> + AnyOf<(F0, F1)> + AnyOf<(F0, F1, F2)> + AnyOf<(F0, F1, F2, F3)> + AnyOf<(F0, F1, F2, F3, F4)> and $N others = note: `ReadOnlyWorldQuery` is implemented for `&A`, but not for `&mut A` = note: required for `QueryManyIter<'_, '_, &mut A, (), std::array::IntoIter>` to implement `Iterator` 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 4be9e86f8f..7d952a9324 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 @@ -13,14 +13,14 @@ error[E0277]: the trait bound `&'static mut Foo: ReadOnlyWorldQuery` is not sati | ^^^^^^^ the trait `ReadOnlyWorldQuery` is not implemented for `&'static mut Foo` | = help: the following other types implement trait `ReadOnlyWorldQuery`: - &T - () - (F0, F1) - (F0, F1, F2) - (F0, F1, F2, F3) - (F0, F1, F2, F3, F4) - (F0, F1, F2, F3, F4, F5) - (F0, F1, F2, F3, F4, F5, F6) + bevy_ecs::change_detection::Ref<'__w, T> + Has + AnyOf<()> + AnyOf<(F0,)> + AnyOf<(F0, F1)> + AnyOf<(F0, F1, F2)> + AnyOf<(F0, F1, F2, F3)> + AnyOf<(F0, F1, F2, F3, F4)> and $N others = note: `ReadOnlyWorldQuery` is implemented for `&'static Foo`, but not for `&'static mut Foo` = note: required for `bevy_ecs::system::Query<'_, '_, &'static mut Foo>` to implement `ReadOnlySystemParam` diff --git a/crates/bevy_ecs_compile_fail_tests/tests/ui/world_query_derive.stderr b/crates/bevy_ecs_compile_fail_tests/tests/ui/world_query_derive.stderr index 158be3f9d7..830a130e50 100644 --- a/crates/bevy_ecs_compile_fail_tests/tests/ui/world_query_derive.stderr +++ b/crates/bevy_ecs_compile_fail_tests/tests/ui/world_query_derive.stderr @@ -5,14 +5,14 @@ error[E0277]: the trait bound `&'static mut Foo: ReadOnlyWorldQuery` is not sati | ^^^^^^^^^^^^^^^^ the trait `ReadOnlyWorldQuery` is not implemented for `&'static mut Foo` | = help: the following other types implement trait `ReadOnlyWorldQuery`: - &T - () - (F0, F1) - (F0, F1, F2) - (F0, F1, F2, F3) - (F0, F1, F2, F3, F4) - (F0, F1, F2, F3, F4, F5) - (F0, F1, F2, F3, F4, F5, F6) + MutableUnmarked + MutableMarkedReadOnly + NestedMutableUnmarked + bevy_ecs::change_detection::Ref<'__w, T> + Has + AnyOf<()> + AnyOf<(F0,)> + AnyOf<(F0, F1)> and $N others note: required by a bound in `_::assert_readonly` --> tests/ui/world_query_derive.rs:7:10 @@ -28,14 +28,14 @@ error[E0277]: the trait bound `MutableMarked: ReadOnlyWorldQuery` is not satisfi | ^^^^^^^^^^^^^ the trait `ReadOnlyWorldQuery` is not implemented for `MutableMarked` | = help: the following other types implement trait `ReadOnlyWorldQuery`: - &T - () - (F0, F1) - (F0, F1, F2) - (F0, F1, F2, F3) - (F0, F1, F2, F3, F4) - (F0, F1, F2, F3, F4, F5) - (F0, F1, F2, F3, F4, F5, F6) + MutableUnmarked + MutableMarkedReadOnly + NestedMutableUnmarked + bevy_ecs::change_detection::Ref<'__w, T> + Has + AnyOf<()> + AnyOf<(F0,)> + AnyOf<(F0, F1)> and $N others note: required by a bound in `_::assert_readonly` --> tests/ui/world_query_derive.rs:18:10 diff --git a/crates/bevy_gizmos/src/gizmos.rs b/crates/bevy_gizmos/src/gizmos.rs index a7e7769a58..c2258bc067 100644 --- a/crates/bevy_gizmos/src/gizmos.rs +++ b/crates/bevy_gizmos/src/gizmos.rs @@ -152,7 +152,7 @@ impl<'s> Gizmos<'s> { /// ``` #[inline] pub fn linestrip(&mut self, positions: impl IntoIterator, color: Color) { - self.extend_strip_positions(positions.into_iter()); + self.extend_strip_positions(positions); let len = self.buffer.strip_positions.len(); self.buffer .strip_colors diff --git a/crates/bevy_gizmos/src/lib.rs b/crates/bevy_gizmos/src/lib.rs index 5d21be330a..22ca7291c3 100644 --- a/crates/bevy_gizmos/src/lib.rs +++ b/crates/bevy_gizmos/src/lib.rs @@ -96,7 +96,9 @@ impl Plugin for GizmoPlugin { .after(TransformSystem::TransformPropagate), ); - let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { return; }; + let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { + return; + }; render_app .add_systems(ExtractSchedule, extract_gizmo_data) @@ -109,7 +111,9 @@ impl Plugin for GizmoPlugin { } fn finish(&self, app: &mut bevy_app::App) { - let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { return; }; + let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { + return; + }; let render_device = render_app.world.resource::(); let layout = render_device.create_bind_group_layout(&BindGroupLayoutDescriptor { diff --git a/crates/bevy_gizmos/src/pipeline_2d.rs b/crates/bevy_gizmos/src/pipeline_2d.rs index 06f21138d8..128998b0b8 100644 --- a/crates/bevy_gizmos/src/pipeline_2d.rs +++ b/crates/bevy_gizmos/src/pipeline_2d.rs @@ -27,7 +27,9 @@ pub struct LineGizmo2dPlugin; impl Plugin for LineGizmo2dPlugin { fn build(&self, app: &mut App) { - let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { return }; + let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { + return; + }; render_app .add_render_command::() @@ -36,7 +38,9 @@ impl Plugin for LineGizmo2dPlugin { } fn finish(&self, app: &mut App) { - let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { return }; + let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { + return; + }; render_app.init_resource::(); } @@ -151,7 +155,9 @@ fn queue_line_gizmos_2d( | Mesh2dPipelineKey::from_hdr(view.hdr); for (entity, handle) in &line_gizmos { - let Some(line_gizmo) = line_gizmo_assets.get(handle) else { continue }; + let Some(line_gizmo) = line_gizmo_assets.get(handle) else { + continue; + }; let pipeline = pipelines.specialize( &pipeline_cache, diff --git a/crates/bevy_gizmos/src/pipeline_3d.rs b/crates/bevy_gizmos/src/pipeline_3d.rs index 14f033f304..9d015f0f04 100644 --- a/crates/bevy_gizmos/src/pipeline_3d.rs +++ b/crates/bevy_gizmos/src/pipeline_3d.rs @@ -25,7 +25,9 @@ use bevy_render::{ pub struct LineGizmo3dPlugin; impl Plugin for LineGizmo3dPlugin { fn build(&self, app: &mut App) { - let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { return }; + let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { + return; + }; render_app .add_render_command::() @@ -34,7 +36,9 @@ impl Plugin for LineGizmo3dPlugin { } fn finish(&self, app: &mut App) { - let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { return }; + let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { + return; + }; render_app.init_resource::(); } @@ -164,7 +168,9 @@ fn queue_line_gizmos_3d( | MeshPipelineKey::from_hdr(view.hdr); for (entity, handle) in &line_gizmos { - let Some(line_gizmo) = line_gizmo_assets.get(handle) else { continue }; + let Some(line_gizmo) = line_gizmo_assets.get(handle) else { + continue; + }; let pipeline = pipelines.specialize( &pipeline_cache, diff --git a/crates/bevy_math/src/cubic_splines.rs b/crates/bevy_math/src/cubic_splines.rs index c0ff6cf272..544e815878 100644 --- a/crates/bevy_math/src/cubic_splines.rs +++ b/crates/bevy_math/src/cubic_splines.rs @@ -133,10 +133,7 @@ impl Hermite

{ tangents: impl IntoIterator, ) -> Self { Self { - control_points: control_points - .into_iter() - .zip(tangents.into_iter()) - .collect(), + control_points: control_points.into_iter().zip(tangents).collect(), } } } diff --git a/crates/bevy_pbr/src/prepass/mod.rs b/crates/bevy_pbr/src/prepass/mod.rs index bfdd3ff003..c402b30e0a 100644 --- a/crates/bevy_pbr/src/prepass/mod.rs +++ b/crates/bevy_pbr/src/prepass/mod.rs @@ -809,7 +809,9 @@ pub fn queue_prepass_material_meshes( let rangefinder = view.rangefinder3d(); for visible_entity in &visible_entities.entities { - let Ok((material_handle, mesh_handle, mesh_transforms, batch_indices)) = material_meshes.get(*visible_entity) else { + let Ok((material_handle, mesh_handle, mesh_transforms, batch_indices)) = + material_meshes.get(*visible_entity) + else { continue; }; diff --git a/crates/bevy_pbr/src/ssao/mod.rs b/crates/bevy_pbr/src/ssao/mod.rs index 276ee261a5..e2d016b957 100644 --- a/crates/bevy_pbr/src/ssao/mod.rs +++ b/crates/bevy_pbr/src/ssao/mod.rs @@ -86,7 +86,9 @@ impl Plugin for ScreenSpaceAmbientOcclusionPlugin { } fn finish(&self, app: &mut App) { - let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { return }; + let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { + return; + }; if !render_app .world @@ -226,7 +228,8 @@ impl ViewNode for SsaoNode { pipeline_cache.get_compute_pipeline(pipelines.preprocess_depth_pipeline), pipeline_cache.get_compute_pipeline(pipelines.spatial_denoise_pipeline), pipeline_cache.get_compute_pipeline(pipeline_id.0), - ) else { + ) + else { return Ok(()); }; @@ -640,7 +643,9 @@ fn prepare_ssao_textures( views: Query<(Entity, &ExtractedCamera), With>, ) { for (entity, camera) in &views { - let Some(physical_viewport_size) = camera.physical_viewport_size else { continue }; + let Some(physical_viewport_size) = camera.physical_viewport_size else { + continue; + }; let size = Extent3d { width: physical_viewport_size.x, height: physical_viewport_size.y, 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 ada309aacf..27a298044e 100644 --- a/crates/bevy_reflect/bevy_reflect_derive/src/derive_data.rs +++ b/crates/bevy_reflect/bevy_reflect_derive/src/derive_data.rs @@ -195,7 +195,8 @@ impl<'a> ReflectDerive<'a> { let syn::Expr::Lit(syn::ExprLit { lit: syn::Lit::Str(lit), .. - }) = &pair.value else { + }) = &pair.value + else { return Err(syn::Error::new( pair.span(), format_args!("`#[{TYPE_PATH_ATTRIBUTE_NAME} = \"...\"]` must be a string literal"), @@ -211,7 +212,8 @@ impl<'a> ReflectDerive<'a> { let syn::Expr::Lit(syn::ExprLit { lit: syn::Lit::Str(lit), .. - }) = &pair.value else { + }) = &pair.value + else { return Err(syn::Error::new( pair.span(), format_args!("`#[{TYPE_NAME_ATTRIBUTE_NAME} = \"...\"]` must be a string literal"), diff --git a/crates/bevy_reflect/src/map.rs b/crates/bevy_reflect/src/map.rs index e31f4280c2..0ddc85a562 100644 --- a/crates/bevy_reflect/src/map.rs +++ b/crates/bevy_reflect/src/map.rs @@ -513,7 +513,7 @@ mod tests { #[test] fn test_into_iter() { - let expected = vec!["foo", "bar", "baz"]; + let expected = ["foo", "bar", "baz"]; let mut map = DynamicMap::default(); map.insert(0usize, expected[0].to_string()); diff --git a/crates/bevy_reflect/src/struct_trait.rs b/crates/bevy_reflect/src/struct_trait.rs index 36e3aaa56a..f2bb3a4563 100644 --- a/crates/bevy_reflect/src/struct_trait.rs +++ b/crates/bevy_reflect/src/struct_trait.rs @@ -507,7 +507,7 @@ impl Debug for DynamicStruct { /// Returns [`None`] if the comparison couldn't even be performed. #[inline] pub fn struct_partial_eq(a: &S, b: &dyn Reflect) -> Option { - let ReflectRef::Struct(struct_value) = b.reflect_ref() else { + let ReflectRef::Struct(struct_value) = b.reflect_ref() else { return Some(false); }; 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 2c503d8a01..40d36dcf97 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 @@ -11,14 +11,14 @@ error[E0277]: the trait bound `NoReflect: Reflect` is not satisfied | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Reflect` is not implemented for `NoReflect` | = help: the following other types implement trait `Reflect`: - &'static Path - () - (A, B) - (A, B, C) - (A, B, C, D) - (A, B, C, D, E) - (A, B, C, D, E, F) - (A, B, C, D, E, F, G) + bool + char + isize + i8 + i16 + i32 + i64 + i128 and $N others note: required for `Foo` to implement `Reflect` --> tests/reflect_derive/generics.fail.rs:3:10 diff --git a/crates/bevy_render/src/color/mod.rs b/crates/bevy_render/src/color/mod.rs index c5839b7cd4..deb642a131 100644 --- a/crates/bevy_render/src/color/mod.rs +++ b/crates/bevy_render/src/color/mod.rs @@ -1990,8 +1990,14 @@ mod tests { let hsla = Color::hsla(0., 0., 0., 0.); let lcha = Color::lcha(0., 0., 0., 0.); assert_eq!(rgba_l, rgba_l.as_rgba_linear()); - let Color::RgbaLinear { .. } = rgba.as_rgba_linear() else { panic!("from Rgba") }; - let Color::RgbaLinear { .. } = hsla.as_rgba_linear() else { panic!("from Hsla") }; - let Color::RgbaLinear { .. } = lcha.as_rgba_linear() else { panic!("from Lcha") }; + let Color::RgbaLinear { .. } = rgba.as_rgba_linear() else { + panic!("from Rgba") + }; + let Color::RgbaLinear { .. } = hsla.as_rgba_linear() else { + panic!("from Hsla") + }; + let Color::RgbaLinear { .. } = lcha.as_rgba_linear() else { + panic!("from Lcha") + }; } } diff --git a/crates/bevy_render/src/mesh/morph.rs b/crates/bevy_render/src/mesh/morph.rs index be52d1f59b..cb523113be 100644 --- a/crates/bevy_render/src/mesh/morph.rs +++ b/crates/bevy_render/src/mesh/morph.rs @@ -74,8 +74,11 @@ impl MorphTargetImage { return Err(MorphBuildError::TooManyTargets { target_count }); } let component_count = (vertex_count * MorphAttributes::COMPONENT_COUNT) as u32; - let Some((Rect(width, height), padding)) = lowest_2d(component_count , max) else { - return Err(MorphBuildError::TooManyAttributes { vertex_count, component_count }); + let Some((Rect(width, height), padding)) = lowest_2d(component_count, max) else { + return Err(MorphBuildError::TooManyAttributes { + vertex_count, + component_count, + }); }; let data = targets .flat_map(|mut attributes| { diff --git a/crates/bevy_render/src/pipelined_rendering.rs b/crates/bevy_render/src/pipelined_rendering.rs index 0e2417e51d..f8fcfe53e9 100644 --- a/crates/bevy_render/src/pipelined_rendering.rs +++ b/crates/bevy_render/src/pipelined_rendering.rs @@ -111,7 +111,9 @@ impl Plugin for PipelinedRenderingPlugin { s.spawn(async { app_to_render_receiver.recv().await }); }) .pop(); - let Some(Ok(mut render_app)) = sent_app else { break }; + let Some(Ok(mut render_app)) = sent_app else { + break; + }; { #[cfg(feature = "trace")] diff --git a/crates/bevy_render/src/render_graph/graph.rs b/crates/bevy_render/src/render_graph/graph.rs index 87fc063ee1..e0bdc9283c 100644 --- a/crates/bevy_render/src/render_graph/graph.rs +++ b/crates/bevy_render/src/render_graph/graph.rs @@ -125,7 +125,9 @@ impl RenderGraph { /// It simply won't create a new edge. pub fn add_node_edges(&mut self, edges: &[&'static str]) { for window in edges.windows(2) { - let [a, b] = window else { break; }; + let [a, b] = window else { + break; + }; if let Err(err) = self.try_add_node_edge(*a, *b) { match err { // Already existing edges are very easy to produce with this api diff --git a/crates/bevy_render/src/render_graph/node.rs b/crates/bevy_render/src/render_graph/node.rs index 9307c235a0..0e4630e3c7 100644 --- a/crates/bevy_render/src/render_graph/node.rs +++ b/crates/bevy_render/src/render_graph/node.rs @@ -398,10 +398,9 @@ where render_context: &mut RenderContext, world: &World, ) -> Result<(), NodeRunError> { - let Ok(view) = self - .view_query - .get_manual(world, graph.view_entity()) - else { return Ok(()); }; + let Ok(view) = self.view_query.get_manual(world, graph.view_entity()) else { + return Ok(()); + }; ViewNode::run(&self.node, graph, render_context, view, world)?; Ok(()) diff --git a/crates/bevy_ui/src/render/render_pass.rs b/crates/bevy_ui/src/render/render_pass.rs index 90e7b6059c..80985b2f26 100644 --- a/crates/bevy_ui/src/render/render_pass.rs +++ b/crates/bevy_ui/src/render/render_pass.rs @@ -49,10 +49,10 @@ impl Node for UiPassNode { let input_view_entity = graph.view_entity(); let Ok((transparent_phase, target, camera_ui)) = - self.ui_view_query.get_manual(world, input_view_entity) - else { - return Ok(()); - }; + self.ui_view_query.get_manual(world, input_view_entity) + else { + return Ok(()); + }; if transparent_phase.items.is_empty() { return Ok(()); } diff --git a/crates/bevy_winit/src/lib.rs b/crates/bevy_winit/src/lib.rs index 504c70ac43..8c79494dec 100644 --- a/crates/bevy_winit/src/lib.rs +++ b/crates/bevy_winit/src/lib.rs @@ -422,20 +422,20 @@ pub fn winit_runner(mut app: App) { event_writer_system_state.get_mut(&mut app.world); let Some(window_entity) = winit_windows.get_window_entity(window_id) else { - warn!( - "Skipped event {:?} for unknown winit Window Id {:?}", - event, window_id - ); - return; - }; + warn!( + "Skipped event {:?} for unknown winit Window Id {:?}", + event, window_id + ); + return; + }; let Ok((mut window, mut cache)) = windows.get_mut(window_entity) else { - warn!( - "Window {:?} is missing `Window` component, skipping event {:?}", - window_entity, event - ); - return; - }; + warn!( + "Window {:?} is missing `Window` component, skipping event {:?}", + window_entity, event + ); + return; + }; runner_state.window_event_received = true; diff --git a/examples/2d/texture_atlas.rs b/examples/2d/texture_atlas.rs index b1f6cb2113..14fda57839 100644 --- a/examples/2d/texture_atlas.rs +++ b/examples/2d/texture_atlas.rs @@ -56,7 +56,10 @@ fn setup( for handle in &rpg_sprite_handles.handles { let handle = handle.typed_weak(); let Some(texture) = textures.get(&handle) else { - warn!("{:?} did not resolve to an `Image` asset.", asset_server.get_handle_path(handle)); + warn!( + "{:?} did not resolve to an `Image` asset.", + asset_server.get_handle_path(handle) + ); continue; }; diff --git a/examples/3d/bloom_3d.rs b/examples/3d/bloom_3d.rs index 7c6f140526..4b68878fcd 100644 --- a/examples/3d/bloom_3d.rs +++ b/examples/3d/bloom_3d.rs @@ -75,7 +75,7 @@ fn setup_scene( 0 => material_emissive1.clone(), 1 => material_emissive2.clone(), 2 => material_emissive3.clone(), - 3 | 4 | 5 => material_non_emissive.clone(), + 3..=5 => material_non_emissive.clone(), _ => unreachable!(), }; diff --git a/examples/animation/morph_targets.rs b/examples/animation/morph_targets.rs index e773fb6cf9..83f216fc33 100644 --- a/examples/animation/morph_targets.rs +++ b/examples/animation/morph_targets.rs @@ -88,8 +88,12 @@ fn name_morphs( return; } - let Some(mesh) = meshes.get(&morph_data.mesh) else { return }; - let Some(names) = mesh.morph_target_names() else { return }; + let Some(mesh) = meshes.get(&morph_data.mesh) else { + return; + }; + let Some(names) = mesh.morph_target_names() else { + return; + }; for name in names { println!(" {name}"); } diff --git a/examples/games/breakout.rs b/examples/games/breakout.rs index d582856cc5..739caf92a1 100644 --- a/examples/games/breakout.rs +++ b/examples/games/breakout.rs @@ -249,11 +249,6 @@ fn setup( commands.spawn(WallBundle::new(WallLocation::Top)); // Bricks - // Negative scales result in flipped sprites / meshes, - // which is definitely not what we want here - assert!(BRICK_SIZE.x > 0.0); - assert!(BRICK_SIZE.y > 0.0); - let total_width_of_bricks = (RIGHT_WALL - LEFT_WALL) - 2. * GAP_BETWEEN_BRICKS_AND_SIDES; let bottom_edge_of_bricks = paddle_y + GAP_BETWEEN_PADDLE_AND_BRICKS; let total_height_of_bricks = TOP_WALL - bottom_edge_of_bricks - GAP_BETWEEN_BRICKS_AND_CEILING; diff --git a/examples/shader/post_processing.rs b/examples/shader/post_processing.rs index 88d197ae72..7aed8e8f85 100644 --- a/examples/shader/post_processing.rs +++ b/examples/shader/post_processing.rs @@ -158,7 +158,8 @@ impl ViewNode for PostProcessNode { let pipeline_cache = world.resource::(); // Get the pipeline from the cache - let Some(pipeline) = pipeline_cache.get_render_pipeline(post_process_pipeline.pipeline_id) else { + let Some(pipeline) = pipeline_cache.get_render_pipeline(post_process_pipeline.pipeline_id) + else { return Ok(()); }; diff --git a/examples/shader/texture_binding_array.rs b/examples/shader/texture_binding_array.rs index c4affd57c1..90bf00afc7 100644 --- a/examples/shader/texture_binding_array.rs +++ b/examples/shader/texture_binding_array.rs @@ -37,7 +37,7 @@ impl Plugin for GpuFeatureSupportChecker { fn finish(&self, app: &mut App) { let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { - return + return; }; let render_device = render_app.world.resource::(); diff --git a/examples/stress_tests/many_gizmos.rs b/examples/stress_tests/many_gizmos.rs index 472b25d5e4..f0a72f451e 100644 --- a/examples/stress_tests/many_gizmos.rs +++ b/examples/stress_tests/many_gizmos.rs @@ -91,7 +91,10 @@ fn setup(mut commands: Commands) { fn ui_system(mut query: Query<&mut Text>, config: Res, diag: Res) { let mut text = query.single_mut(); - let Some(fps) = diag.get(FrameTimeDiagnosticsPlugin::FPS).and_then(|fps| fps.smoothed()) else { + let Some(fps) = diag + .get(FrameTimeDiagnosticsPlugin::FPS) + .and_then(|fps| fps.smoothed()) + else { return; }; diff --git a/examples/tools/scene_viewer/morph_viewer_plugin.rs b/examples/tools/scene_viewer/morph_viewer_plugin.rs index e71a41db95..b82bef0f20 100644 --- a/examples/tools/scene_viewer/morph_viewer_plugin.rs +++ b/examples/tools/scene_viewer/morph_viewer_plugin.rs @@ -181,7 +181,9 @@ fn update_text( mut text: Query<&mut Text>, morphs: Query<&MorphWeights>, ) { - let Some(mut controls) = controls else { return; }; + let Some(mut controls) = controls else { + return; + }; for (i, target) in controls.weights.iter_mut().enumerate() { let Ok(weights) = morphs.get(target.entity) else { continue; @@ -203,7 +205,9 @@ fn update_morphs( input: Res>, time: Res