From 38e293cf5d30a1609020c034d66e5aac3b844073 Mon Sep 17 00:00:00 2001 From: Jack Huey Date: Mon, 21 Dec 2020 22:49:03 -0500 Subject: [PATCH] Remove PredicateKind::Atom --- clippy_lints/src/needless_pass_by_value.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/clippy_lints/src/needless_pass_by_value.rs b/clippy_lints/src/needless_pass_by_value.rs index a435f86bfd8..ad50a6a0405 100644 --- a/clippy_lints/src/needless_pass_by_value.rs +++ b/clippy_lints/src/needless_pass_by_value.rs @@ -115,13 +115,15 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPassByValue { .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 ty::PredicateKind::ForAll(binder) = obligation.predicate.kind(); + 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::>();