Skip to content

Commit 053aedc

Browse files
committed
clippy::filter_map_identity
1 parent 066eb6a commit 053aedc

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

compiler/rustc_hir/src/def.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ impl<T> PerNS<Option<T>> {
476476

477477
/// Returns an iterator over the items which are `Some`.
478478
pub fn present_items(self) -> impl Iterator<Item = T> {
479-
IntoIter::new([self.type_ns, self.value_ns, self.macro_ns]).filter_map(|it| it)
479+
IntoIter::new([self.type_ns, self.value_ns, self.macro_ns]).flatten()
480480
}
481481
}
482482

compiler/rustc_parse/src/parser/item.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,8 +1107,7 @@ impl<'a> Parser<'a> {
11071107
e
11081108
})?;
11091109

1110-
let enum_definition =
1111-
EnumDef { variants: variants.into_iter().filter_map(|v| v).collect() };
1110+
let enum_definition = EnumDef { variants: variants.into_iter().flatten().collect() };
11121111
Ok((id, ItemKind::Enum(enum_definition, generics)))
11131112
}
11141113

compiler/rustc_typeck/src/check/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ fn fn_sig_suggestion<'tcx>(
791791
})
792792
})
793793
.chain(std::iter::once(if sig.c_variadic { Some("...".to_string()) } else { None }))
794-
.filter_map(|arg| arg)
794+
.flatten()
795795
.collect::<Vec<String>>()
796796
.join(", ");
797797
let output = sig.output();

0 commit comments

Comments
 (0)