Skip to content

Commit a6aa0ac

Browse files
author
Michael Wright
committed
Fix dogfood errors
1 parent 3af09b8 commit a6aa0ac

File tree

5 files changed

+13
-10
lines changed

5 files changed

+13
-10
lines changed

clippy_lints/src/manual_ok_or.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use rustc_lint::LintContext;
88
use rustc_lint::{LateContext, LateLintPass};
99
use rustc_middle::lint::in_external_macro;
1010
use rustc_session::{declare_lint_pass, declare_tool_lint};
11+
use rustc_span::symbol::sym;
1112

1213
declare_clippy_lint! {
1314
/// **What it does:**
@@ -51,7 +52,7 @@ impl LateLintPass<'_> for ManualOkOr {
5152
if args.len() == 3;
5253
let method_receiver = &args[0];
5354
let ty = cx.typeck_results().expr_ty(method_receiver);
54-
if is_type_diagnostic_item(cx, ty, sym!(option_type));
55+
if is_type_diagnostic_item(cx, ty, sym::option_type);
5556
let or_expr = &args[1];
5657
if is_ok_wrapping(cx, &args[2]);
5758
if let ExprKind::Call(Expr { kind: ExprKind::Path(err_path), .. }, &[ref err_arg]) = or_expr.kind;

clippy_lints/src/methods/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1568,7 +1568,7 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
15681568
lint_expect_fun_call(cx, expr, *method_span, &method_call.ident.as_str(), args);
15691569

15701570
let self_ty = cx.typeck_results().expr_ty_adjusted(&args[0]);
1571-
if args.len() == 1 && method_call.ident.name == sym!(clone) {
1571+
if args.len() == 1 && method_call.ident.name == sym::clone {
15721572
lint_clone_on_copy(cx, expr, &args[0], self_ty);
15731573
lint_clone_on_ref_ptr(cx, expr, &args[0]);
15741574
}
@@ -1592,7 +1592,7 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
15921592
}
15931593
}
15941594
},
1595-
ty::Ref(..) if method_call.ident.name == sym!(into_iter) => {
1595+
ty::Ref(..) if method_call.ident.name == sym::into_iter => {
15961596
lint_into_iter(cx, expr, self_ty, *method_span);
15971597
},
15981598
_ => (),
@@ -2638,9 +2638,9 @@ fn lint_unwrap(cx: &LateContext<'_>, expr: &hir::Expr<'_>, unwrap_args: &[hir::E
26382638
fn lint_expect(cx: &LateContext<'_>, expr: &hir::Expr<'_>, expect_args: &[hir::Expr<'_>]) {
26392639
let obj_ty = cx.typeck_results().expr_ty(&expect_args[0]).peel_refs();
26402640

2641-
let mess = if is_type_diagnostic_item(cx, obj_ty, sym!(option_type)) {
2641+
let mess = if is_type_diagnostic_item(cx, obj_ty, sym::option_type) {
26422642
Some((EXPECT_USED, "an Option", "None"))
2643-
} else if is_type_diagnostic_item(cx, obj_ty, sym!(result_type)) {
2643+
} else if is_type_diagnostic_item(cx, obj_ty, sym::result_type) {
26442644
Some((EXPECT_USED, "a Result", "Err"))
26452645
} else {
26462646
None
@@ -3133,7 +3133,7 @@ fn lint_search_is_some<'tcx>(
31333133
else if search_method == "find" {
31343134
let is_string_or_str_slice = |e| {
31353135
let self_ty = cx.typeck_results().expr_ty(e).peel_refs();
3136-
if is_type_diagnostic_item(cx, self_ty, sym!(string_type)) {
3136+
if is_type_diagnostic_item(cx, self_ty, sym::string_type) {
31373137
true
31383138
} else {
31393139
*self_ty.kind() == ty::Str

clippy_lints/src/ref_option_ref.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use crate::utils::{last_path_segment, snippet, span_lint_and_sugg};
22
use rustc_hir::{GenericArg, Mutability, Ty, TyKind};
33
use rustc_lint::{LateContext, LateLintPass};
44
use rustc_session::{declare_lint_pass, declare_tool_lint};
5+
use rustc_span::symbol::sym;
56

67
use if_chain::if_chain;
78
use rustc_errors::Applicability;
@@ -41,7 +42,7 @@ impl<'tcx> LateLintPass<'tcx> for RefOptionRef {
4142
if let Some(res) = last.res;
4243
if let Some(def_id) = res.opt_def_id();
4344

44-
if cx.tcx.is_diagnostic_item(sym!(option_type), def_id);
45+
if cx.tcx.is_diagnostic_item(sym::option_type, def_id);
4546
if let Some(ref params) = last_path_segment(qpath).args ;
4647
if !params.parenthesized;
4748
if let Some(inner_ty) = params.args.iter().find_map(|arg| match arg {

clippy_lints/src/strings.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ impl LateLintPass<'_> for StringToString {
372372
if let ExprKind::MethodCall(path, _, args, _) = &expr.kind;
373373
if path.ident.name == sym!(to_string);
374374
let ty = cx.typeck_results().expr_ty(&args[0]);
375-
if is_type_diagnostic_item(cx, ty, sym!(string_type));
375+
if is_type_diagnostic_item(cx, ty, sym::string_type);
376376
then {
377377
span_lint_and_help(
378378
cx,

clippy_lints/src/unnecessary_wraps.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use rustc_hir::{Body, ExprKind, FnDecl, HirId, ItemKind, Node};
99
use rustc_lint::{LateContext, LateLintPass};
1010
use rustc_middle::ty::subst::GenericArgKind;
1111
use rustc_session::{declare_lint_pass, declare_tool_lint};
12+
use rustc_span::symbol::sym;
1213
use rustc_span::Span;
1314

1415
declare_clippy_lint! {
@@ -82,9 +83,9 @@ impl<'tcx> LateLintPass<'tcx> for UnnecessaryWraps {
8283
}
8384
}
8485

85-
let (return_type, path) = if is_type_diagnostic_item(cx, return_ty(cx, hir_id), sym!(option_type)) {
86+
let (return_type, path) = if is_type_diagnostic_item(cx, return_ty(cx, hir_id), sym::option_type) {
8687
("Option", &paths::OPTION_SOME)
87-
} else if is_type_diagnostic_item(cx, return_ty(cx, hir_id), sym!(result_type)) {
88+
} else if is_type_diagnostic_item(cx, return_ty(cx, hir_id), sym::result_type) {
8889
("Result", &paths::RESULT_OK)
8990
} else {
9091
return;

0 commit comments

Comments
 (0)