Skip to content

Commit

Permalink
chore(clippy): minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
kaosat-dev committed May 16, 2024
1 parent f561112 commit 00bf63c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 21 deletions.
7 changes: 1 addition & 6 deletions crates/bevy_gltf_components/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
22 changes: 10 additions & 12 deletions crates/bevy_gltf_components/src/ronstring_to_reflect_component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,23 @@ pub fn ronstring_to_reflect_component(
let mut components: Vec<(Box<dyn Reflect>, 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,
value,
parsed_value,
type_registry,
&mut components,
)
);
}
}
components
Expand Down Expand Up @@ -95,13 +94,12 @@ fn bevy_components_string_to_components(
) {
let lookup: HashMap<String, Value> = 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());
Expand Down
5 changes: 2 additions & 3 deletions crates/bevy_registry_export/src/export_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ pub fn export_types(world: &mut World) {

let asset_root = world.resource::<AssetRoot>();
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();
Expand All @@ -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::<Map<_, _>>();
Expand Down

0 comments on commit 00bf63c

Please sign in to comment.