Skip to content

Commit 87e78d5

Browse files
committed
Account for API changes
1 parent 64c358a commit 87e78d5

File tree

1 file changed

+6
-8
lines changed
  • clippy_utils/src/ty/type_certainty

1 file changed

+6
-8
lines changed

clippy_utils/src/ty/type_certainty/mod.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ pub fn expr_type_is_certain(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
3131

3232
fn expr_type_certainty(cx: &LateContext<'_>, expr: &Expr<'_>) -> Certainty {
3333
let certainty = match &expr.kind {
34-
ExprKind::Box(expr)
35-
| ExprKind::Unary(_, expr)
34+
ExprKind::Unary(_, expr)
3635
| ExprKind::Field(expr, _)
3736
| ExprKind::Index(expr, _)
3837
| ExprKind::AddrOf(_, _, expr) => expr_type_certainty(cx, expr),
@@ -170,8 +169,7 @@ fn qpath_certainty(cx: &LateContext<'_>, qpath: &QPath<'_>, resolves_to_type: bo
170169
QPath::LangItem(lang_item, _, _) => {
171170
cx.tcx
172171
.lang_items()
173-
.require(*lang_item)
174-
.ok()
172+
.get(*lang_item)
175173
.map_or(Certainty::Uncertain, |def_id| {
176174
let generics = cx.tcx.generics_of(def_id);
177175
if generics.parent_count == 0 && generics.params.is_empty() {
@@ -230,8 +228,8 @@ fn path_segment_certainty(
230228
Certainty::Certain(None)
231229
},
232230

233-
// `get_parent_node` because `hir_id` refers to a `Pat`, and we're interested in the node containing the `Pat`.
234-
Res::Local(hir_id) => match cx.tcx.hir().get(cx.tcx.hir().get_parent_node(hir_id)) {
231+
// `get_parent` because `hir_id` refers to a `Pat`, and we're interested in the node containing the `Pat`.
232+
Res::Local(hir_id) => match cx.tcx.hir().get_parent(hir_id) {
235233
// An argument's type is always certain.
236234
Node::Param(..) => Certainty::Certain(None),
237235
// A local's type is certain if its type annotation is certain or it has an initializer whose
@@ -292,7 +290,7 @@ fn type_is_inferrable_from_arguments(cx: &LateContext<'_>, expr: &Expr<'_>) -> b
292290

293291
(0..(generics.parent_count + generics.params.len()) as u32).all(|index| {
294292
fn_sig.inputs().iter().any(|input_ty| {
295-
input_ty.walk().any(|arg| {
293+
input_ty.skip_binder().walk().any(|arg| {
296294
if let GenericArgKind::Type(ty) = arg.unpack() {
297295
ty.is_param(index)
298296
} else {
@@ -304,7 +302,7 @@ fn type_is_inferrable_from_arguments(cx: &LateContext<'_>, expr: &Expr<'_>) -> b
304302
}
305303

306304
fn self_ty<'tcx>(cx: &LateContext<'tcx>, method_def_id: DefId) -> Ty<'tcx> {
307-
cx.tcx.fn_sig(method_def_id).skip_binder().inputs()[0]
305+
cx.tcx.fn_sig(method_def_id).skip_binder().inputs().skip_binder()[0]
308306
}
309307

310308
fn adt_def_id(ty: Ty<'_>) -> Option<DefId> {

0 commit comments

Comments
 (0)