Skip to content

Commit afa28e6

Browse files
committed
change usages of explicit_item_bounds to bound_explicit_item_bounds
1 parent d3b1001 commit afa28e6

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

clippy_lints/src/future_not_send.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use rustc_hir::intravisit::FnKind;
44
use rustc_hir::{Body, FnDecl};
55
use rustc_infer::infer::TyCtxtInferExt;
66
use rustc_lint::{LateContext, LateLintPass};
7-
use rustc_middle::ty::{self, AliasTy, Clause, EarlyBinder, PredicateKind};
7+
use rustc_middle::ty::{self, AliasTy, Clause, PredicateKind};
88
use rustc_session::{declare_lint_pass, declare_tool_lint};
99
use rustc_span::def_id::LocalDefId;
1010
use rustc_span::{sym, Span};
@@ -64,10 +64,9 @@ impl<'tcx> LateLintPass<'tcx> for FutureNotSend {
6464
}
6565
let ret_ty = return_ty(cx, cx.tcx.hir().local_def_id_to_hir_id(fn_def_id).expect_owner());
6666
if let ty::Alias(ty::Opaque, AliasTy { def_id, substs, .. }) = *ret_ty.kind() {
67-
let preds = cx.tcx.explicit_item_bounds(def_id);
67+
let preds = cx.tcx.bound_explicit_item_bounds(def_id);
6868
let mut is_future = false;
69-
for &(p, _span) in preds {
70-
let p = EarlyBinder(p).subst(cx.tcx, substs);
69+
for (p, _span) in preds.subst_iter_copied(cx.tcx, substs) {
7170
if let Some(trait_pred) = p.to_opt_poly_trait_pred() {
7271
if Some(trait_pred.skip_binder().trait_ref.def_id) == cx.tcx.lang_items().future_trait() {
7372
is_future = true;

clippy_utils/src/ty.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ pub fn contains_ty_adt_constructor_opaque<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'
9090
return false;
9191
}
9292

93-
for &(predicate, _span) in cx.tcx.explicit_item_bounds(def_id) {
93+
for bound in cx.tcx.bound_explicit_item_bounds(def_id).transpose_iter() {
94+
let (predicate, _span) = bound.map_bound(|b| *b).subst_identity();
9495
match predicate.kind().skip_binder() {
9596
// For `impl Trait<U>`, it will register a predicate of `T: Trait<U>`, so we go through
9697
// and check substituions to find `U`.
@@ -267,7 +268,7 @@ pub fn is_must_use_ty<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> bool {
267268
},
268269
ty::Tuple(substs) => substs.iter().any(|ty| is_must_use_ty(cx, ty)),
269270
ty::Alias(ty::Opaque, ty::AliasTy { def_id, .. }) => {
270-
for (predicate, _) in cx.tcx.explicit_item_bounds(*def_id) {
271+
for (predicate, _) in cx.tcx.bound_explicit_item_bounds(*def_id).skip_binder() {
271272
if let ty::PredicateKind::Clause(ty::Clause::Trait(trait_predicate)) = predicate.kind().skip_binder() {
272273
if cx.tcx.has_attr(trait_predicate.trait_ref.def_id, sym::must_use) {
273274
return true;

0 commit comments

Comments
 (0)