Skip to content

Commit

Permalink
Simplify name collection
Browse files Browse the repository at this point in the history
Co-authored-by: François <mockersf@gmail.com>
  • Loading branch information
MrGVSV and mockersf authored Oct 31, 2022
1 parent 940d207 commit 1d330f4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion crates/bevy_reflect/src/enums/enum_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ impl EnumInfo {
.map(|(index, variant)| (variant.name(), index))
.collect::<HashMap<_, _>>();

let variant_names = variants.iter().map(|variant| variant.name()).collect();
let variant_names = variant_indices.keys().collect();

Self {
name,
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_reflect/src/enums/variants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ impl StructVariantInfo {
/// Create a new [`StructVariantInfo`].
pub fn new(name: &'static str, fields: &[NamedField]) -> Self {
let field_indices = Self::collect_field_indices(fields);
let field_names = fields.iter().map(|field| field.name()).collect();
let field_names = field_indices.keys().collect();
Self {
name,
fields: fields.to_vec().into_boxed_slice(),
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_reflect/src/struct_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ impl StructInfo {
.map(|(index, field)| (field.name(), index))
.collect::<HashMap<_, _>>();

let field_names = fields.iter().map(|field| field.name()).collect();
let field_names = field_indices.keys().collect();

Self {
name,
Expand Down

0 comments on commit 1d330f4

Please sign in to comment.