]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/unwrap_in_result.rs
Rollup merge of #83092 - petrochenkov:qspan, r=estebank
[rust.git] / clippy_lints / src / unwrap_in_result.rs
index fde3102933098415d2aece0bc10df6aac083f302..8cb7429849da65bf207d9221c5f6805f5aecd17b 100644 (file)
@@ -57,8 +57,8 @@ fn check_impl_item(&mut self, cx: &LateContext<'tcx>, impl_item: &'tcx hir::Impl
             // first check if it's a method or function
             if let hir::ImplItemKind::Fn(ref _signature, _) = impl_item.kind;
             // checking if its return type is `result` or `option`
-            if is_type_diagnostic_item(cx, return_ty(cx, impl_item.hir_id), sym::result_type)
-                || is_type_diagnostic_item(cx, return_ty(cx, impl_item.hir_id), sym::option_type);
+            if is_type_diagnostic_item(cx, return_ty(cx, impl_item.hir_id()), sym::result_type)
+                || is_type_diagnostic_item(cx, return_ty(cx, impl_item.hir_id()), sym::option_type);
             then {
                 lint_impl_body(cx, impl_item.span, impl_item);
             }
@@ -114,10 +114,9 @@ fn lint_impl_body<'tcx>(cx: &LateContext<'tcx>, impl_span: Span, impl_item: &'tc
         if let ImplItemKind::Fn(_, body_id) = impl_item.kind;
         then {
             let body = cx.tcx.hir().body(body_id);
-            let impl_item_def_id = cx.tcx.hir().local_def_id(impl_item.hir_id);
             let mut fpu = FindExpectUnwrap {
                 lcx: cx,
-                typeck_results: cx.tcx.typeck(impl_item_def_id),
+                typeck_results: cx.tcx.typeck(impl_item.def_id),
                 result: Vec::new(),
             };
             fpu.visit_expr(&body.value);