Skip to content

Commit

Permalink
Fix clippy errors
Browse files Browse the repository at this point in the history
  • Loading branch information
MrGVSV committed Jul 4, 2022
1 parent 40cec54 commit 3c450e0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 3 additions & 2 deletions crates/bevy_reflect/bevy_reflect_derive/src/enum_utility.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ pub(crate) fn get_variant_constructors(

let fields = match &variant.fields {
EnumVariantFields::Unit => &[],
EnumVariantFields::Named(fields) => fields.as_slice(),
EnumVariantFields::Unnamed(fields) => fields.as_slice(),
EnumVariantFields::Named(fields) | EnumVariantFields::Unnamed(fields) => {
fields.as_slice()
}
};
let mut reflect_index: usize = 0;
let constructor_fields = fields.iter().enumerate().map(|(declar_index, field)| {
Expand Down
8 changes: 6 additions & 2 deletions crates/bevy_reflect/src/enums/dynamic_enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,12 +287,16 @@ impl Reflect for DynamicEnum {
VariantType::Struct => {
for field in value.iter_fields() {
let name = field.name().unwrap();
Enum::field_mut(self, name).map(|v| v.apply(field.value()));
if let Some(v) = Enum::field_mut(self, name) {
v.apply(field.value());
}
}
}
VariantType::Tuple => {
for (index, field) in value.iter_fields().enumerate() {
Enum::field_at_mut(self, index).map(|v| v.apply(field.value()));
if let Some(v) = Enum::field_at_mut(self, index) {
v.apply(field.value());
}
}
}
_ => {}
Expand Down

0 comments on commit 3c450e0

Please sign in to comment.