Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiaskrgr committed Apr 10, 2020
1 parent 5e8c0c5 commit 3961f2d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions clippy_lints/src/needless_pass_by_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessPassByValue {

let preds = traits::elaborate_predicates(cx.tcx, cx.param_env.caller_bounds.to_vec())
.filter(|p| !p.is_global())
.filter_map(|pred| {
if let ty::Predicate::Trait(poly_trait_ref, _) = pred {
.filter_map(|obligation| {
if let ty::Predicate::Trait(poly_trait_ref, _) = obligation.predicate {
if poly_trait_ref.def_id() == sized_trait || poly_trait_ref.skip_binder().has_escaping_bound_vars()
{
return None;
Expand Down
8 changes: 7 additions & 1 deletion clippy_lints/src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1389,7 +1389,13 @@ pub fn fn_has_unsatisfiable_preds(cx: &LateContext<'_, '_>, did: DefId) -> bool
.iter()
.filter_map(|(p, _)| if p.is_global() { Some(*p) } else { None })
.collect();
!traits::normalize_and_test_predicates(cx.tcx, traits::elaborate_predicates(cx.tcx, predicates).collect())
!traits::normalize_and_test_predicates(
cx.tcx,
traits::elaborate_predicates(cx.tcx, predicates)
.into_iter()
.map(|o| o.predicate)
.collect::<Vec<_>>(),
)
}

#[cfg(test)]
Expand Down

0 comments on commit 3961f2d

Please sign in to comment.