diff options
| author | Jack Huey <jack.huey@umassmed.edu> | 2020-12-21 22:49:03 -0500 |
|---|---|---|
| committer | Jack Huey <jack.huey@umassmed.edu> | 2021-01-16 18:40:47 -0500 |
| commit | 38e293cf5d30a1609020c034d66e5aac3b844073 (patch) | |
| tree | 3d072c5c187a6631f1fda4365ebe2acd1f171d62 | |
| parent | 7b3af4145b62781f6f8cf0b003cfd81780b608ec (diff) | |
| download | rust-38e293cf5d30a1609020c034d66e5aac3b844073.tar.gz rust-38e293cf5d30a1609020c034d66e5aac3b844073.zip | |
Remove PredicateKind::Atom
| -rw-r--r-- | clippy_lints/src/needless_pass_by_value.rs | 14 |
1 files 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::<Vec<_>>(); |
