From 7ea82c2c4821d5639e0654e104819997de83eb45 Mon Sep 17 00:00:00 2001 From: targrub Date: Wed, 26 Oct 2022 12:19:36 -0400 Subject: [PATCH 1/5] Fix warning clippy::only-used-in-recursion --- crates/bevy_gltf/src/loader.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/bevy_gltf/src/loader.rs b/crates/bevy_gltf/src/loader.rs index ce80600020b1f..f740b09a701b2 100644 --- a/crates/bevy_gltf/src/loader.rs +++ b/crates/bevy_gltf/src/loader.rs @@ -697,7 +697,7 @@ fn load_node( gltf_node: &gltf::Node, world_builder: &mut WorldChildBuilder, load_context: &mut LoadContext, - buffer_data: &[Vec], + _buffer_data: &[Vec], node_index_to_entity_map: &mut HashMap, entity_to_skin_index_map: &mut HashMap, active_camera_found: &mut bool, @@ -893,7 +893,7 @@ fn load_node( &child, parent, load_context, - buffer_data, + _buffer_data, node_index_to_entity_map, entity_to_skin_index_map, active_camera_found, From f75f86444ebd9de12c4a9c4f0522f9533e10c634 Mon Sep 17 00:00:00 2001 From: targrub Date: Wed, 26 Oct 2022 12:24:32 -0400 Subject: [PATCH 2/5] Fix clippy::explicit-auto-deref warning. --- crates/bevy_audio/src/audio_output.rs | 2 +- crates/bevy_ecs/src/bundle.rs | 2 +- crates/bevy_ecs/src/world/world_cell.rs | 2 +- crates/bevy_render/src/extract_resource.rs | 4 ++-- crates/bevy_render/src/mesh/mesh/skinning.rs | 2 +- crates/bevy_scene/src/scene_loader.rs | 2 +- crates/bevy_scene/src/serde.rs | 2 +- crates/bevy_tasks/src/task_pool.rs | 2 +- crates/bevy_text/src/text2d.rs | 6 +++--- crates/bevy_ui/src/flex/mod.rs | 4 ++-- crates/bevy_ui/src/widget/text.rs | 6 +++--- 11 files changed, 17 insertions(+), 17 deletions(-) diff --git a/crates/bevy_audio/src/audio_output.rs b/crates/bevy_audio/src/audio_output.rs index e378a2c43f4c3..b4f942c7c84c9 100644 --- a/crates/bevy_audio/src/audio_output.rs +++ b/crates/bevy_audio/src/audio_output.rs @@ -90,7 +90,7 @@ pub fn play_queued_audio_system( mut sinks: ResMut>, ) { if let Some(audio_sources) = audio_sources { - audio_output.try_play_queued(&*audio_sources, &mut *audio, &mut *sinks); + audio_output.try_play_queued(&*audio_sources, &mut *audio, &mut sinks); }; } diff --git a/crates/bevy_ecs/src/bundle.rs b/crates/bevy_ecs/src/bundle.rs index 52bd4af31030e..05bf7b346cd55 100644 --- a/crates/bevy_ecs/src/bundle.rs +++ b/crates/bevy_ecs/src/bundle.rs @@ -577,7 +577,7 @@ impl<'a, 'b> BundleInserter<'a, 'b> { // redundant copies let move_result = self .table - .move_to_superset_unchecked(result.table_row, *new_table); + .move_to_superset_unchecked(result.table_row, new_table); let new_location = new_archetype.allocate(entity, move_result.new_row); self.entities.meta[entity.id as usize].location = new_location; diff --git a/crates/bevy_ecs/src/world/world_cell.rs b/crates/bevy_ecs/src/world/world_cell.rs index 71c8216b24939..7679e51c40730 100644 --- a/crates/bevy_ecs/src/world/world_cell.rs +++ b/crates/bevy_ecs/src/world/world_cell.rs @@ -155,7 +155,7 @@ impl<'w, T> Deref for WorldBorrowMut<'w, T> { impl<'w, T> DerefMut for WorldBorrowMut<'w, T> { fn deref_mut(&mut self) -> &mut Self::Target { - &mut *self.value + &mut self.value } } diff --git a/crates/bevy_render/src/extract_resource.rs b/crates/bevy_render/src/extract_resource.rs index 5201021bd4fe0..3fa92750421c8 100644 --- a/crates/bevy_render/src/extract_resource.rs +++ b/crates/bevy_render/src/extract_resource.rs @@ -48,7 +48,7 @@ pub fn extract_resource( ) { if let Some(mut target_resource) = target_resource { if main_resource.is_changed() { - *target_resource = R::extract_resource(&*main_resource); + *target_resource = R::extract_resource(&main_resource); } } else { #[cfg(debug_assertions)] @@ -60,6 +60,6 @@ pub fn extract_resource( std::any::type_name::() ); } - commands.insert_resource(R::extract_resource(&*main_resource)); + commands.insert_resource(R::extract_resource(&main_resource)); } } diff --git a/crates/bevy_render/src/mesh/mesh/skinning.rs b/crates/bevy_render/src/mesh/mesh/skinning.rs index 6d152689069ea..3c3cef062de06 100644 --- a/crates/bevy_render/src/mesh/mesh/skinning.rs +++ b/crates/bevy_render/src/mesh/mesh/skinning.rs @@ -39,6 +39,6 @@ impl From> for SkinnedMeshInverseBindposes { impl Deref for SkinnedMeshInverseBindposes { type Target = [Mat4]; fn deref(&self) -> &Self::Target { - &*self.0 + &self.0 } } diff --git a/crates/bevy_scene/src/scene_loader.rs b/crates/bevy_scene/src/scene_loader.rs index e13b2541eeb13..9054c4cf30ae5 100644 --- a/crates/bevy_scene/src/scene_loader.rs +++ b/crates/bevy_scene/src/scene_loader.rs @@ -30,7 +30,7 @@ impl AssetLoader for SceneLoader { Box::pin(async move { let mut deserializer = ron::de::Deserializer::from_bytes(bytes)?; let scene_deserializer = SceneDeserializer { - type_registry: &*self.type_registry.read(), + type_registry: &self.type_registry.read(), }; let scene = scene_deserializer.deserialize(&mut deserializer)?; load_context.set_default_asset(LoadedAsset::new(scene)); diff --git a/crates/bevy_scene/src/serde.rs b/crates/bevy_scene/src/serde.rs index 7515785692a8c..d7e669f2de333 100644 --- a/crates/bevy_scene/src/serde.rs +++ b/crates/bevy_scene/src/serde.rs @@ -104,7 +104,7 @@ impl<'a> Serialize for ComponentsSerializer<'a> { for component in self.components { state.serialize_element(&ReflectSerializer::new( &**component, - &*self.registry.read(), + &self.registry.read(), ))?; } state.end() diff --git a/crates/bevy_tasks/src/task_pool.rs b/crates/bevy_tasks/src/task_pool.rs index 1ec2c9d4c514d..a33454758d95c 100644 --- a/crates/bevy_tasks/src/task_pool.rs +++ b/crates/bevy_tasks/src/task_pool.rs @@ -236,7 +236,7 @@ impl TaskPool { // This is guaranteed because we drive all the futures spawned onto the Scope // to completion in this function. However, rust has no way of knowing this so we // transmute the lifetimes to 'env here to appease the compiler as it is unable to validate safety. - let executor: &async_executor::Executor = &*self.executor; + let executor: &async_executor::Executor = &self.executor; let executor: &'env async_executor::Executor = unsafe { mem::transmute(executor) }; let task_scope_executor = &async_executor::Executor::default(); let task_scope_executor: &'env async_executor::Executor = diff --git a/crates/bevy_text/src/text2d.rs b/crates/bevy_text/src/text2d.rs index 530812cea1e7d..ee3663ac59308 100644 --- a/crates/bevy_text/src/text2d.rs +++ b/crates/bevy_text/src/text2d.rs @@ -189,9 +189,9 @@ pub fn update_text2d_layout( scale_factor, text.alignment, text_bounds, - &mut *font_atlas_set_storage, - &mut *texture_atlases, - &mut *textures, + &mut font_atlas_set_storage, + &mut texture_atlases, + &mut textures, text_settings.as_ref(), YAxisOrientation::BottomToTop, ) { diff --git a/crates/bevy_ui/src/flex/mod.rs b/crates/bevy_ui/src/flex/mod.rs index acd341e2cf5f7..ebe6e1ad4d394 100644 --- a/crates/bevy_ui/src/flex/mod.rs +++ b/crates/bevy_ui/src/flex/mod.rs @@ -237,9 +237,9 @@ pub fn flex_node_system( let scale_factor = logical_to_physical_factor * ui_scale.scale; if scale_factor_events.iter().next_back().is_some() || ui_scale.is_changed() { - update_changed(&mut *flex_surface, scale_factor, full_node_query); + update_changed(&mut flex_surface, scale_factor, full_node_query); } else { - update_changed(&mut *flex_surface, scale_factor, node_query); + update_changed(&mut flex_surface, scale_factor, node_query); } fn update_changed( diff --git a/crates/bevy_ui/src/widget/text.rs b/crates/bevy_ui/src/widget/text.rs index c2b3f6ef68e21..7c9076a584390 100644 --- a/crates/bevy_ui/src/widget/text.rs +++ b/crates/bevy_ui/src/widget/text.rs @@ -117,9 +117,9 @@ pub fn text_system( scale_factor, text.alignment, node_size, - &mut *font_atlas_set_storage, - &mut *texture_atlases, - &mut *textures, + &mut font_atlas_set_storage, + &mut texture_atlases, + &mut textures, text_settings.as_ref(), YAxisOrientation::TopToBottom, ) { From 32f9dee20e38593a69d8fa92fca95a6fb87c6267 Mon Sep 17 00:00:00 2001 From: targrub Date: Wed, 26 Oct 2022 12:25:50 -0400 Subject: [PATCH 3/5] Fixed clippy::needless-borrow warning. --- crates/bevy_asset/src/asset_server.rs | 2 +- examples/games/contributors.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/bevy_asset/src/asset_server.rs b/crates/bevy_asset/src/asset_server.rs index 6e26ad1b23683..217ef50898d0d 100644 --- a/crates/bevy_asset/src/asset_server.rs +++ b/crates/bevy_asset/src/asset_server.rs @@ -788,7 +788,7 @@ mod test { fn create_dir_and_file(file: impl AsRef) -> tempfile::TempDir { let asset_dir = tempfile::tempdir().unwrap(); - std::fs::write(asset_dir.path().join(file), &[]).unwrap(); + std::fs::write(asset_dir.path().join(file), []).unwrap(); asset_dir } diff --git a/examples/games/contributors.rs b/examples/games/contributors.rs index 77f5e3bf97640..8194a0fed11aa 100644 --- a/examples/games/contributors.rs +++ b/examples/games/contributors.rs @@ -324,7 +324,7 @@ fn contributors() -> Result { let manifest_dir = std::env::var("CARGO_MANIFEST_DIR").map_err(LoadContributorsError::Var)?; let mut cmd = std::process::Command::new("git") - .args(&["--no-pager", "log", "--pretty=format:%an"]) + .args(["--no-pager", "log", "--pretty=format:%an"]) .current_dir(manifest_dir) .stdout(Stdio::piped()) .spawn() From cff4d4a53f5b5b2763ee2c3554184ceb4a8a1af3 Mon Sep 17 00:00:00 2001 From: targrub Date: Wed, 26 Oct 2022 12:29:00 -0400 Subject: [PATCH 4/5] Formatting change. --- crates/bevy_scene/src/serde.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/crates/bevy_scene/src/serde.rs b/crates/bevy_scene/src/serde.rs index d7e669f2de333..f15e989e7d6e8 100644 --- a/crates/bevy_scene/src/serde.rs +++ b/crates/bevy_scene/src/serde.rs @@ -102,10 +102,8 @@ impl<'a> Serialize for ComponentsSerializer<'a> { { let mut state = serializer.serialize_seq(Some(self.components.len()))?; for component in self.components { - state.serialize_element(&ReflectSerializer::new( - &**component, - &self.registry.read(), - ))?; + state + .serialize_element(&ReflectSerializer::new(&**component, &self.registry.read()))?; } state.end() } From 8aaa021fa3b97e9838480c720b87cbdbd3d57e8e Mon Sep 17 00:00:00 2001 From: targrub Date: Wed, 26 Oct 2022 14:09:44 -0400 Subject: [PATCH 5/5] load_node doesn't use buffer_data, so removed the argument. --- crates/bevy_gltf/src/loader.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/crates/bevy_gltf/src/loader.rs b/crates/bevy_gltf/src/loader.rs index f740b09a701b2..e0f0e836aebd1 100644 --- a/crates/bevy_gltf/src/loader.rs +++ b/crates/bevy_gltf/src/loader.rs @@ -472,7 +472,6 @@ async fn load_gltf<'a, 'b>( &node, parent, load_context, - &buffer_data, &mut node_index_to_entity_map, &mut entity_to_skin_index_map, &mut active_camera_found, @@ -697,7 +696,6 @@ fn load_node( gltf_node: &gltf::Node, world_builder: &mut WorldChildBuilder, load_context: &mut LoadContext, - _buffer_data: &[Vec], node_index_to_entity_map: &mut HashMap, entity_to_skin_index_map: &mut HashMap, active_camera_found: &mut bool, @@ -893,7 +891,6 @@ fn load_node( &child, parent, load_context, - _buffer_data, node_index_to_entity_map, entity_to_skin_index_map, active_camera_found,