Skip to content

Commit a0c2da9

Browse files
committed
Extract closure for trait ref filtering.
1 parent a5df0a3 commit a0c2da9

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

clippy_lints/src/trait_bounds.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -334,13 +334,16 @@ fn into_comparable_trait_ref(trait_ref: &TraitRef<'_>) -> ComparableTraitRef {
334334
fn rollup_traits(cx: &LateContext<'_>, bounds: &[GenericBound<'_>], msg: &str) {
335335
let mut map = FxHashMap::default();
336336
let mut repeated_res = false;
337-
for bound in bounds.iter().filter_map(|bound| {
337+
338+
let only_comparable_trait_refs = |bound: &GenericBound<'_>| {
338339
if let GenericBound::Trait(t, _) = bound {
339340
Some((into_comparable_trait_ref(&t.trait_ref), t.span))
340341
} else {
341342
None
342343
}
343-
}) {
344+
};
345+
346+
for bound in bounds.iter().filter_map(only_comparable_trait_refs) {
344347
let (comparable_bound, span_direct) = bound;
345348
if map.insert(comparable_bound, span_direct).is_some() {
346349
repeated_res = true;

0 commit comments

Comments
 (0)