Skip to content

Commit

Permalink
Fix clippy stuff (#1433)
Browse files Browse the repository at this point in the history
* Fix clippy stuff

* Add comments explaining inconsistency

Also explains that the code is unused
  • Loading branch information
DJMcNab committed Feb 11, 2021
1 parent 7be096a commit 3a32a21
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 7 additions & 3 deletions crates/bevy_reflect/src/impls/bevy_ecs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ impl<Scene: Component + IntoComponent<Runtime>, Runtime: Component> FromType<Sce
scene_entity,
runtime_entity| {
let scene_component = scene_world.get::<Scene>(scene_entity).unwrap();
let destination_component = scene_component.into_component(resources);
let destination_component = scene_component.as_component(resources);
runtime_world
.insert_one(runtime_entity, destination_component)
.unwrap();
Expand Down Expand Up @@ -195,7 +195,7 @@ impl<Runtime: Component + IntoComponent<Scene>, Scene: Component> FromType<Runti
runtime_entity,
scene_entity| {
let runtime_component = runtime_world.get::<Runtime>(runtime_entity).unwrap();
let scene_component = runtime_component.into_component(resources);
let scene_component = runtime_component.as_component(resources);
scene_world
.insert_one(scene_entity, scene_component)
.unwrap();
Expand Down Expand Up @@ -236,6 +236,10 @@ impl<C: Component + MapEntities> FromType<C> for ReflectMapEntities {
}
}

// TODO: Dead code - this trait is never implemented
// The name of the method was changed in <https://github.com/bevyengine/bevy/pull/1433>
// to fix the update to clippy for Rust 1.50
// which is why this is inconsistent
pub trait IntoComponent<ToComponent: Component> {
fn into_component(&self, resources: &Resources) -> ToComponent;
fn as_component(&self, resources: &Resources) -> ToComponent;
}
2 changes: 2 additions & 0 deletions crates/bevy_reflect/src/type_registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ where
}
}

// TODO: Dead code
// This trait seems to be unused apart from in implementations of this trait
pub trait FromType<T> {
fn from_type() -> Self;
}
Expand Down

0 comments on commit 3a32a21

Please sign in to comment.