]> git.lizzy.rs Git - rust.git/commitdiff
Fix dogfood after MatchTypeOnDiagItem
authorEduardo Broto <ebroto@tutanota.com>
Sun, 6 Sep 2020 21:48:04 +0000 (23:48 +0200)
committerEduardo Broto <ebroto@tutanota.com>
Tue, 15 Sep 2020 08:29:53 +0000 (10:29 +0200)
clippy_lints/src/loops.rs
clippy_lints/src/methods/mod.rs
clippy_lints/src/option_if_let_else.rs

index 6c54c07869ad1a6a2b7f1814fef1ed6ee20718d6..3d2fd0eee85a70c2536c83d170ad8d8f84342651 100644 (file)
@@ -1114,7 +1114,7 @@ fn get_vec_push<'tcx>(cx: &LateContext<'tcx>, stmt: &'tcx Stmt<'_>) -> Option<(&
             if let Some(self_expr) = args.get(0);
             if let Some(pushed_item) = args.get(1);
             // Check that the method being called is push() on a Vec
-            if match_type(cx, cx.typeck_results().expr_ty(self_expr), &paths::VEC);
+            if is_type_diagnostic_item(cx, cx.typeck_results().expr_ty(self_expr), sym!(vec_type));
             if path.ident.name.as_str() == "push";
             then {
                 return Some((self_expr, pushed_item))
index 98e027b6d2290b7cde3e2bfbc68b64960df4c9ed..de966cccd111c3da615ce9dceb35f9a87e4a86ff 100644 (file)
@@ -1808,7 +1808,7 @@ fn check_general_case<'tcx>(
                     _ => (),
                 }
 
-                if match_type(cx, ty, &paths::VEC) {
+                if is_type_diagnostic_item(cx, ty, sym!(vec_type)) {
                     return;
                 }
             }
index 9494efe736cce2a37f7efafdf211b62a6e075214..60e5e7bfed398e03ccd9226b3ce47d30b0edae41 100644 (file)
@@ -1,6 +1,6 @@
 use crate::utils;
 use crate::utils::sugg::Sugg;
-use crate::utils::{match_type, paths, span_lint_and_sugg};
+use crate::utils::{is_type_diagnostic_item, paths, span_lint_and_sugg};
 use if_chain::if_chain;
 
 use rustc_errors::Applicability;
@@ -73,7 +73,7 @@
 fn is_result_ok(cx: &LateContext<'_>, expr: &'_ Expr<'_>) -> bool {
     if let ExprKind::MethodCall(ref path, _, &[ref receiver], _) = &expr.kind {
         path.ident.name.to_ident_string() == "ok"
-            && match_type(cx, &cx.typeck_results().expr_ty(&receiver), &paths::RESULT)
+            && is_type_diagnostic_item(cx, &cx.typeck_results().expr_ty(&receiver), sym!(result_type))
     } else {
         false
     }