Skip to content

Commit

Permalink
Remove unnecesary collect
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucretiel committed Jun 17, 2023
1 parent a0dadc1 commit d7b37bf
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions core/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -588,22 +588,20 @@ fn get_field_decorators(
.map(|(language, list)| {
(
language,
list.into_iter()
.filter_map(|nested| match nested {
NestedMeta::Meta(Meta::Path(path)) if path.segments.len() == 1 => {
Some(FieldDecorator::Word(path.get_ident()?.to_string()))
}
NestedMeta::Meta(Meta::NameValue(name_value)) => {
Some(FieldDecorator::NameValue(
name_value.path.get_ident()?.to_string(),
literal_as_string(name_value.lit)?,
))
}
// TODO: this should throw a visible error since it suggests a malformed
// attribute.
_ => None,
})
.collect::<BTreeSet<_>>(),
list.into_iter().filter_map(|nested| match nested {
NestedMeta::Meta(Meta::Path(path)) if path.segments.len() == 1 => {
Some(FieldDecorator::Word(path.get_ident()?.to_string()))
}
NestedMeta::Meta(Meta::NameValue(name_value)) => {
Some(FieldDecorator::NameValue(
name_value.path.get_ident()?.to_string(),
literal_as_string(name_value.lit)?,
))
}
// TODO: this should throw a visible error since it suggests a malformed
// attribute.
_ => None,
}),
)
})
.fold(HashMap::new(), |mut acc, (language, decorators)| {
Expand Down

0 comments on commit d7b37bf

Please sign in to comment.