From 9751dd97406237486881379a10583bfb2c705401 Mon Sep 17 00:00:00 2001 From: Samuel Moelius Date: Sun, 9 Jul 2023 19:39:14 -0400 Subject: [PATCH] Account for API changes --- clippy_utils/src/ty/type_certainty/mod.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/clippy_utils/src/ty/type_certainty/mod.rs b/clippy_utils/src/ty/type_certainty/mod.rs index 789b0613a24c..d00eab399be8 100644 --- a/clippy_utils/src/ty/type_certainty/mod.rs +++ b/clippy_utils/src/ty/type_certainty/mod.rs @@ -31,8 +31,7 @@ pub fn expr_type_is_certain(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool { fn expr_type_certainty(cx: &LateContext<'_>, expr: &Expr<'_>) -> Certainty { let certainty = match &expr.kind { - ExprKind::Box(expr) - | ExprKind::Unary(_, expr) + ExprKind::Unary(_, expr) | ExprKind::Field(expr, _) | ExprKind::Index(expr, _) | ExprKind::AddrOf(_, _, expr) => expr_type_certainty(cx, expr), @@ -170,8 +169,7 @@ fn qpath_certainty(cx: &LateContext<'_>, qpath: &QPath<'_>, resolves_to_type: bo QPath::LangItem(lang_item, _, _) => { cx.tcx .lang_items() - .require(*lang_item) - .ok() + .get(*lang_item) .map_or(Certainty::Uncertain, |def_id| { let generics = cx.tcx.generics_of(def_id); if generics.parent_count == 0 && generics.params.is_empty() { @@ -230,8 +228,8 @@ fn path_segment_certainty( Certainty::Certain(None) }, - // `get_parent_node` because `hir_id` refers to a `Pat`, and we're interested in the node containing the `Pat`. - Res::Local(hir_id) => match cx.tcx.hir().get(cx.tcx.hir().get_parent_node(hir_id)) { + // `get_parent` because `hir_id` refers to a `Pat`, and we're interested in the node containing the `Pat`. + Res::Local(hir_id) => match cx.tcx.hir().get_parent(hir_id) { // An argument's type is always certain. Node::Param(..) => Certainty::Certain(None), // 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 (0..(generics.parent_count + generics.params.len()) as u32).all(|index| { fn_sig.inputs().iter().any(|input_ty| { - input_ty.walk().any(|arg| { + input_ty.skip_binder().walk().any(|arg| { if let GenericArgKind::Type(ty) = arg.unpack() { ty.is_param(index) } else { @@ -304,7 +302,7 @@ fn type_is_inferrable_from_arguments(cx: &LateContext<'_>, expr: &Expr<'_>) -> b } fn self_ty<'tcx>(cx: &LateContext<'tcx>, method_def_id: DefId) -> Ty<'tcx> { - cx.tcx.fn_sig(method_def_id).skip_binder().inputs()[0] + cx.tcx.fn_sig(method_def_id).skip_binder().inputs().skip_binder()[0] } fn adt_def_id(ty: Ty<'_>) -> Option {