Skip to content

Commit a3ff2b9

Browse files
authored
Rollup merge of rust-lang#112060 - lcnr:early-binder, r=jackh726
`EarlyBinder::new` -> `EarlyBinder::bind` for consistency with `Binder::bind`. it may make sense to also add `EarlyBinder::dummy` in places where we know that no parameters exist, but I left that out of this PR. r? `@jackh726` `@kylematsuda`
2 parents faf2e5d + 739530a commit a3ff2b9

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

clippy_lints/src/dereference.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1219,7 +1219,7 @@ fn needless_borrow_impl_arg_position<'tcx>(
12191219
return false;
12201220
}
12211221

1222-
let predicate = EarlyBinder::new(predicate).subst(cx.tcx, &substs_with_referent_ty);
1222+
let predicate = EarlyBinder::bind(predicate).subst(cx.tcx, &substs_with_referent_ty);
12231223
let obligation = Obligation::new(cx.tcx, ObligationCause::dummy(), cx.param_env, predicate);
12241224
let infcx = cx.tcx.infer_ctxt().build();
12251225
infcx.predicate_must_hold_modulo_regions(&obligation)

clippy_lints/src/eta_reduction.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ fn get_ufcs_type_name<'tcx>(cx: &LateContext<'tcx>, method_def_id: DefId, substs
243243
| ty::Ref(..)
244244
| ty::Slice(_)
245245
| ty::Tuple(_) => {
246-
format!("<{}>", EarlyBinder::new(ty).subst(cx.tcx, substs))
246+
format!("<{}>", EarlyBinder::bind(ty).subst(cx.tcx, substs))
247247
},
248248
_ => ty.to_string(),
249249
}

clippy_lints/src/methods/needless_collect.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ fn is_contains_sig(cx: &LateContext<'_>, call_id: HirId, iter_expr: &Expr<'_>) -
241241
&& let proj_ty = cx.tcx.mk_projection(iter_item.def_id, substs)
242242
&& let Ok(item_ty) = cx.tcx.try_normalize_erasing_regions(cx.param_env, proj_ty)
243243
{
244-
item_ty == EarlyBinder::new(search_ty).subst(cx.tcx, cx.typeck_results().node_substs(call_id))
244+
item_ty == EarlyBinder::bind(search_ty).subst(cx.tcx, cx.typeck_results().node_substs(call_id))
245245
} else {
246246
false
247247
}

clippy_lints/src/methods/unnecessary_to_owned.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ fn can_change_type<'a>(cx: &LateContext<'a>, mut expr: &'a Expr<'a>, mut ty: Ty<
428428
}));
429429

430430
if trait_predicates.any(|predicate| {
431-
let predicate = EarlyBinder::new(predicate).subst(cx.tcx, new_subst);
431+
let predicate = EarlyBinder::bind(predicate).subst(cx.tcx, new_subst);
432432
let obligation = Obligation::new(cx.tcx, ObligationCause::dummy(), cx.param_env, predicate);
433433
!cx.tcx.infer_ctxt().build().predicate_must_hold_modulo_regions(&obligation)
434434
}) {
@@ -438,7 +438,7 @@ fn can_change_type<'a>(cx: &LateContext<'a>, mut expr: &'a Expr<'a>, mut ty: Ty<
438438
let output_ty = fn_sig.output();
439439
if output_ty.contains(*param_ty) {
440440
if let Ok(new_ty) = cx.tcx.try_subst_and_normalize_erasing_regions(
441-
new_subst, cx.param_env, EarlyBinder::new(output_ty)) {
441+
new_subst, cx.param_env, EarlyBinder::bind(output_ty)) {
442442
expr = parent_expr;
443443
ty = new_ty;
444444
continue;

clippy_utils/src/consts.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ impl<'a, 'tcx> ConstEvalLateContext<'a, 'tcx> {
462462
let substs = if self.substs.is_empty() {
463463
substs
464464
} else {
465-
EarlyBinder::new(substs).subst(self.lcx.tcx, self.substs)
465+
EarlyBinder::bind(substs).subst(self.lcx.tcx, self.substs)
466466
};
467467

468468
let result = self

0 commit comments

Comments
 (0)