Skip to content

Commit 6f7f945

Browse files
committed
Fix dogfood after MatchTypeOnDiagItem
1 parent 7e1d960 commit 6f7f945

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

clippy_lints/src/loops.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1114,7 +1114,7 @@ fn get_vec_push<'tcx>(cx: &LateContext<'tcx>, stmt: &'tcx Stmt<'_>) -> Option<(&
11141114
if let Some(self_expr) = args.get(0);
11151115
if let Some(pushed_item) = args.get(1);
11161116
// Check that the method being called is push() on a Vec
1117-
if match_type(cx, cx.typeck_results().expr_ty(self_expr), &paths::VEC);
1117+
if is_type_diagnostic_item(cx, cx.typeck_results().expr_ty(self_expr), sym!(vec_type));
11181118
if path.ident.name.as_str() == "push";
11191119
then {
11201120
return Some((self_expr, pushed_item))

clippy_lints/src/methods/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1808,7 +1808,7 @@ fn lint_or_fun_call<'tcx>(
18081808
_ => (),
18091809
}
18101810

1811-
if match_type(cx, ty, &paths::VEC) {
1811+
if is_type_diagnostic_item(cx, ty, sym!(vec_type)) {
18121812
return;
18131813
}
18141814
}

clippy_lints/src/option_if_let_else.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::utils;
22
use crate::utils::sugg::Sugg;
3-
use crate::utils::{match_type, paths, span_lint_and_sugg};
3+
use crate::utils::{is_type_diagnostic_item, paths, span_lint_and_sugg};
44
use if_chain::if_chain;
55

66
use rustc_errors::Applicability;
@@ -73,7 +73,7 @@ declare_lint_pass!(OptionIfLetElse => [OPTION_IF_LET_ELSE]);
7373
fn is_result_ok(cx: &LateContext<'_>, expr: &'_ Expr<'_>) -> bool {
7474
if let ExprKind::MethodCall(ref path, _, &[ref receiver], _) = &expr.kind {
7575
path.ident.name.to_ident_string() == "ok"
76-
&& match_type(cx, &cx.typeck_results().expr_ty(&receiver), &paths::RESULT)
76+
&& is_type_diagnostic_item(cx, &cx.typeck_results().expr_ty(&receiver), sym!(result_type))
7777
} else {
7878
false
7979
}

clippy_lints/src/unnecessary_sort_by.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use crate::utils;
2-
use crate::utils::paths;
32
use crate::utils::sugg::Sugg;
43
use if_chain::if_chain;
54
use rustc_errors::Applicability;
@@ -176,7 +175,7 @@ fn detect_lint(cx: &LateContext<'_>, expr: &Expr<'_>) -> Option<LintTrigger> {
176175
if let name = name_ident.ident.name.to_ident_string();
177176
if name == "sort_by" || name == "sort_unstable_by";
178177
if let [vec, Expr { kind: ExprKind::Closure(_, _, closure_body_id, _, _), .. }] = args;
179-
if utils::match_type(cx, &cx.typeck_results().expr_ty(vec), &paths::VEC);
178+
if utils::is_type_diagnostic_item(cx, &cx.typeck_results().expr_ty(vec), sym!(vec_type));
180179
if let closure_body = cx.tcx.hir().body(*closure_body_id);
181180
if let &[
182181
Param { pat: Pat { kind: PatKind::Binding(_, _, left_ident, _), .. }, ..},

0 commit comments

Comments
 (0)