]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/clippy/clippy_lints/src/needless_pass_by_value.rs
Cleanup
[rust.git] / src / tools / clippy / clippy_lints / src / needless_pass_by_value.rs
index a435f86bfd8d56af2f8892b53517127bbd622c7a..9306b198051c260d72134d767942cfbd547a9a7c 100644 (file)
@@ -115,13 +115,15 @@ fn check_fn(
             .filter(|p| !p.is_global())
             .filter_map(|obligation| {
                 // Note that we do not want to deal with qualified predicates here.
-                if let ty::PredicateKind::Atom(ty::PredicateAtom::Trait(pred, _)) = obligation.predicate.kind() {
-                    if pred.def_id() == sized_trait {
-                        return None;
+                let binder = obligation.predicate.bound_atom();
+                match binder.skip_binder() {
+                    ty::PredicateAtom::Trait(pred, _) if !binder.has_escaping_bound_vars() => {
+                        if pred.def_id() == sized_trait {
+                            return None;
+                        }
+                        Some(pred)
                     }
-                    Some(pred)
-                } else {
-                    None
+                    _ => None,
                 }
             })
             .collect::<Vec<_>>();