X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;ds=sidebyside;f=src%2Ftools%2Fclippy%2Fclippy_lints%2Fsrc%2Funwrap_in_result.rs;h=a4680ae137b3254e13f3c318448194a10211c8f9;hb=e500f1c1e9de96edc3ac1ce1bccc0f241fa41c0a;hp=6eadd1fc1c93363159d9597fa9ecb1bfb17e7e83;hpb=1176d306cdd22e64aa9ffe0dad953c38deba1f42;p=rust.git diff --git a/src/tools/clippy/clippy_lints/src/unwrap_in_result.rs b/src/tools/clippy/clippy_lints/src/unwrap_in_result.rs index 6eadd1fc1c9..a4680ae137b 100644 --- a/src/tools/clippy/clippy_lints/src/unwrap_in_result.rs +++ b/src/tools/clippy/clippy_lints/src/unwrap_in_result.rs @@ -64,8 +64,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) + || is_type_diagnostic_item(cx, return_ty(cx, impl_item.hir_id()), sym::Option); then { lint_impl_body(cx, impl_item.span, impl_item); } @@ -86,8 +86,8 @@ fn visit_expr(&mut self, expr: &'tcx Expr<'_>) { // check for `expect` if let Some(arglists) = method_chain_args(expr, &["expect"]) { let reciever_ty = self.typeck_results.expr_ty(&arglists[0][0]).peel_refs(); - if is_type_diagnostic_item(self.lcx, reciever_ty, sym::option_type) - || is_type_diagnostic_item(self.lcx, reciever_ty, sym::result_type) + if is_type_diagnostic_item(self.lcx, reciever_ty, sym::Option) + || is_type_diagnostic_item(self.lcx, reciever_ty, sym::Result) { self.result.push(expr.span); } @@ -96,8 +96,8 @@ fn visit_expr(&mut self, expr: &'tcx Expr<'_>) { // check for `unwrap` if let Some(arglists) = method_chain_args(expr, &["unwrap"]) { let reciever_ty = self.typeck_results.expr_ty(&arglists[0][0]).peel_refs(); - if is_type_diagnostic_item(self.lcx, reciever_ty, sym::option_type) - || is_type_diagnostic_item(self.lcx, reciever_ty, sym::result_type) + if is_type_diagnostic_item(self.lcx, reciever_ty, sym::Option) + || is_type_diagnostic_item(self.lcx, reciever_ty, sym::Result) { self.result.push(expr.span); }