Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 38e293c

Browse files
committed
Remove PredicateKind::Atom
1 parent 7b3af41 commit 38e293c

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

clippy_lints/src/needless_pass_by_value.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,15 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPassByValue {
115115
.filter(|p| !p.is_global())
116116
.filter_map(|obligation| {
117117
// Note that we do not want to deal with qualified predicates here.
118-
if let ty::PredicateKind::Atom(ty::PredicateAtom::Trait(pred, _)) = obligation.predicate.kind() {
119-
if pred.def_id() == sized_trait {
120-
return None;
118+
let ty::PredicateKind::ForAll(binder) = obligation.predicate.kind();
119+
match binder.skip_binder() {
120+
ty::PredicateAtom::Trait(pred, _) if !binder.has_escaping_bound_vars() => {
121+
if pred.def_id() == sized_trait {
122+
return None;
123+
}
124+
Some(pred)
121125
}
122-
Some(pred)
123-
} else {
124-
None
126+
_ => None,
125127
}
126128
})
127129
.collect::<Vec<_>>();

0 commit comments

Comments
 (0)