From 00bf63cbd3a68e7bc51870186aa024bcea40f5ed Mon Sep 17 00:00:00 2001 From: "kaosat.dev" Date: Thu, 16 May 2024 22:38:45 +0200 Subject: [PATCH] chore(clippy): minor tweaks --- crates/bevy_gltf_components/src/lib.rs | 7 +----- .../src/ronstring_to_reflect_component.rs | 22 +++++++++---------- .../bevy_registry_export/src/export_types.rs | 5 ++--- 3 files changed, 13 insertions(+), 21 deletions(-) diff --git a/crates/bevy_gltf_components/src/lib.rs b/crates/bevy_gltf_components/src/lib.rs index 8982d5a..79af3d7 100644 --- a/crates/bevy_gltf_components/src/lib.rs +++ b/crates/bevy_gltf_components/src/lib.rs @@ -62,14 +62,9 @@ pub enum GltfComponentsSet { #[derive(Clone, Resource)] pub struct GltfComponentsConfig {} +#[derive(Default)] pub struct ComponentsFromGltfPlugin {} -impl Default for ComponentsFromGltfPlugin { - fn default() -> Self { - Self {} - } -} - impl Plugin for ComponentsFromGltfPlugin { fn build(&self, app: &mut App) { app.add_plugins(blender_settings::plugin) diff --git a/crates/bevy_gltf_components/src/ronstring_to_reflect_component.rs b/crates/bevy_gltf_components/src/ronstring_to_reflect_component.rs index cab89ac..fc0c741 100644 --- a/crates/bevy_gltf_components/src/ronstring_to_reflect_component.rs +++ b/crates/bevy_gltf_components/src/ronstring_to_reflect_component.rs @@ -15,16 +15,15 @@ pub fn ronstring_to_reflect_component( let mut components: Vec<(Box, TypeRegistration)> = Vec::new(); // println!("ron_string {:?}", ron_string); for (name, value) in lookup.into_iter() { - let parsed_value: String; - match value.clone() { + let parsed_value: String = match value.clone() { Value::String(str) => { - parsed_value = str; + str } - _ => parsed_value = ron::to_string(&value).unwrap().to_string(), - } + _ => ron::to_string(&value).unwrap().to_string(), + }; if name.as_str() == "bevy_components" { - bevy_components_string_to_components(parsed_value, type_registry, &mut components) + bevy_components_string_to_components(parsed_value, type_registry, &mut components); } else { components_string_to_components( name, @@ -32,7 +31,7 @@ pub fn ronstring_to_reflect_component( parsed_value, type_registry, &mut components, - ) + ); } } components @@ -95,13 +94,12 @@ fn bevy_components_string_to_components( ) { let lookup: HashMap = ron::from_str(&parsed_value).unwrap(); for (key, value) in lookup.into_iter() { - let parsed_value: String; - match value.clone() { + let parsed_value: String = match value.clone() { Value::String(str) => { - parsed_value = str; + str } - _ => parsed_value = ron::to_string(&value).unwrap().to_string(), - } + _ => ron::to_string(&value).unwrap().to_string(), + }; if let Some(type_registration) = type_registry.get_with_type_path(key.as_str()) { debug!("TYPE INFO {:?}", type_registration.type_info()); diff --git a/crates/bevy_registry_export/src/export_types.rs b/crates/bevy_registry_export/src/export_types.rs index 7660f62..5bda876 100644 --- a/crates/bevy_registry_export/src/export_types.rs +++ b/crates/bevy_registry_export/src/export_types.rs @@ -17,7 +17,6 @@ pub fn export_types(world: &mut World) { let asset_root = world.resource::(); let registry_save_path = Path::join(&asset_root.0, &config.save_path); - println!("registry_save_path {}", registry_save_path.display()); let writer = File::create(registry_save_path).expect("should have created schema file"); let components_to_filter_out = &config.component_filter.clone(); @@ -29,8 +28,8 @@ pub fn export_types(world: &mut World) { .iter() .filter(|type_info| { let type_id = type_info.type_id(); - return components_to_filter_out.is_allowed_by_id(type_id) - && resources_to_filter_out.is_allowed_by_id(type_id); + components_to_filter_out.is_allowed_by_id(type_id) + && resources_to_filter_out.is_allowed_by_id(type_id) }) .map(export_type) .collect::>();