Skip to content

Commit e165c12

Browse files
committed
Make diangostic item names consistent
1 parent 2cb37a1 commit e165c12

File tree

96 files changed

+196
-193
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+196
-193
lines changed

clippy_lints/src/booleans.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,8 @@ fn simplify_not(cx: &LateContext<'_>, expr: &Expr<'_>) -> Option<String> {
260260
},
261261
ExprKind::MethodCall(path, _, args, _) if args.len() == 1 => {
262262
let type_of_receiver = cx.typeck_results().expr_ty(&args[0]);
263-
if !is_type_diagnostic_item(cx, type_of_receiver, sym::option_type)
264-
&& !is_type_diagnostic_item(cx, type_of_receiver, sym::result_type)
263+
if !is_type_diagnostic_item(cx, type_of_receiver, sym::Option)
264+
&& !is_type_diagnostic_item(cx, type_of_receiver, sym::Result)
265265
{
266266
return None;
267267
}

clippy_lints/src/case_sensitive_file_extension_comparisons.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ fn check_case_sensitive_file_extension_comparison(ctx: &LateContext<'_>, expr: &
5555
return Some(span);
5656
},
5757
ty::Adt(&ty::AdtDef { did, .. }, _) => {
58-
if ctx.tcx.is_diagnostic_item(sym::string_type, did) {
58+
if ctx.tcx.is_diagnostic_item(sym::String, did) {
5959
return Some(span);
6060
}
6161
},

clippy_lints/src/cognitive_complexity.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ impl CognitiveComplexity {
6767
helper.visit_expr(expr);
6868
let CcHelper { cc, returns } = helper;
6969
let ret_ty = cx.typeck_results().node_type(expr.hir_id);
70-
let ret_adjust = if is_type_diagnostic_item(cx, ret_ty, sym::result_type) {
70+
let ret_adjust = if is_type_diagnostic_item(cx, ret_ty, sym::Result) {
7171
returns
7272
} else {
7373
#[allow(clippy::integer_division)]

clippy_lints/src/doc.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ fn lint_for_missing_headers<'tcx>(
307307
}
308308
if !headers.errors {
309309
let hir_id = cx.tcx.hir().local_def_id_to_hir_id(def_id);
310-
if is_type_diagnostic_item(cx, return_ty(cx, hir_id), sym::result_type) {
310+
if is_type_diagnostic_item(cx, return_ty(cx, hir_id), sym::Result) {
311311
span_lint(
312312
cx,
313313
MISSING_ERRORS_DOC,
@@ -325,7 +325,7 @@ fn lint_for_missing_headers<'tcx>(
325325
if let ty::Opaque(_, subs) = ret_ty.kind();
326326
if let Some(gen) = subs.types().next();
327327
if let ty::Generator(_, subs, _) = gen.kind();
328-
if is_type_diagnostic_item(cx, subs.as_generator().return_ty(), sym::result_type);
328+
if is_type_diagnostic_item(cx, subs.as_generator().return_ty(), sym::Result);
329329
then {
330330
span_lint(
331331
cx,
@@ -760,8 +760,8 @@ impl<'a, 'tcx> Visitor<'tcx> for FindPanicUnwrap<'a, 'tcx> {
760760
// check for `unwrap`
761761
if let Some(arglists) = method_chain_args(expr, &["unwrap"]) {
762762
let reciever_ty = self.typeck_results.expr_ty(&arglists[0][0]).peel_refs();
763-
if is_type_diagnostic_item(self.cx, reciever_ty, sym::option_type)
764-
|| is_type_diagnostic_item(self.cx, reciever_ty, sym::result_type)
763+
if is_type_diagnostic_item(self.cx, reciever_ty, sym::Option)
764+
|| is_type_diagnostic_item(self.cx, reciever_ty, sym::Result)
765765
{
766766
self.panic_span = Some(expr.span);
767767
}

clippy_lints/src/fallible_impl_from.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl<'tcx> LateLintPass<'tcx> for FallibleImplFrom {
5757
if_chain! {
5858
if let hir::ItemKind::Impl(impl_) = &item.kind;
5959
if let Some(impl_trait_ref) = cx.tcx.impl_trait_ref(item.def_id);
60-
if cx.tcx.is_diagnostic_item(sym::from_trait, impl_trait_ref.def_id);
60+
if cx.tcx.is_diagnostic_item(sym::From, impl_trait_ref.def_id);
6161
then {
6262
lint_impl_body(cx, item.span, impl_.items);
6363
}
@@ -94,8 +94,8 @@ fn lint_impl_body<'tcx>(cx: &LateContext<'tcx>, impl_span: Span, impl_items: &[h
9494
// check for `unwrap`
9595
if let Some(arglists) = method_chain_args(expr, &["unwrap"]) {
9696
let reciever_ty = self.typeck_results.expr_ty(&arglists[0][0]).peel_refs();
97-
if is_type_diagnostic_item(self.lcx, reciever_ty, sym::option_type)
98-
|| is_type_diagnostic_item(self.lcx, reciever_ty, sym::result_type)
97+
if is_type_diagnostic_item(self.lcx, reciever_ty, sym::Option)
98+
|| is_type_diagnostic_item(self.lcx, reciever_ty, sym::Result)
9999
{
100100
self.result.push(expr.span);
101101
}

clippy_lints/src/format.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ impl<'tcx> LateLintPass<'tcx> for UselessFormat {
6565
if_chain! {
6666
if format_args.format_string_symbols == [kw::Empty];
6767
if match cx.typeck_results().expr_ty(value).peel_refs().kind() {
68-
ty::Adt(adt, _) => cx.tcx.is_diagnostic_item(sym::string_type, adt.did),
68+
ty::Adt(adt, _) => cx.tcx.is_diagnostic_item(sym::String, adt.did),
6969
ty::Str => true,
7070
_ => false,
7171
};

clippy_lints/src/from_over_into.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ impl LateLintPass<'_> for FromOverInto {
6161
if_chain! {
6262
if let hir::ItemKind::Impl{ .. } = &item.kind;
6363
if let Some(impl_trait_ref) = cx.tcx.impl_trait_ref(item.def_id);
64-
if cx.tcx.is_diagnostic_item(sym::into_trait, impl_trait_ref.def_id);
64+
if cx.tcx.is_diagnostic_item(sym::Into, impl_trait_ref.def_id);
6565

6666
then {
6767
span_lint_and_help(

clippy_lints/src/from_str_radix_10.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,5 +98,5 @@ impl LateLintPass<'tcx> for FromStrRadix10 {
9898

9999
/// Checks if a Ty is `String` or `&str`
100100
fn is_ty_stringish(cx: &LateContext<'_>, ty: Ty<'_>) -> bool {
101-
is_type_diagnostic_item(cx, ty, sym::string_type) || is_type_diagnostic_item(cx, ty, sym::str)
101+
is_type_diagnostic_item(cx, ty, sym::String) || is_type_diagnostic_item(cx, ty, sym::str)
102102
}

clippy_lints/src/functions/result_unit_err.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ fn check_result_unit_err(cx: &LateContext<'_>, decl: &hir::FnDecl<'_>, item_span
4848
if !in_external_macro(cx.sess(), item_span);
4949
if let hir::FnRetTy::Return(ty) = decl.output;
5050
let ty = hir_ty_to_ty(cx.tcx, ty);
51-
if is_type_diagnostic_item(cx, ty, sym::result_type);
51+
if is_type_diagnostic_item(cx, ty, sym::Result);
5252
if let ty::Adt(_, substs) = ty.kind();
5353
let err_ty = substs.type_at(1);
5454
if err_ty.is_unit();

clippy_lints/src/future_not_send.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ impl<'tcx> LateLintPass<'tcx> for FutureNotSend {
7575
}
7676
}
7777
if is_future {
78-
let send_trait = cx.tcx.get_diagnostic_item(sym::send_trait).unwrap();
78+
let send_trait = cx.tcx.get_diagnostic_item(sym::Send).unwrap();
7979
let span = decl.output.span();
8080
let send_result = cx.tcx.infer_ctxt().enter(|infcx| {
8181
let cause = traits::ObligationCause::misc(span, hir_id);

clippy_lints/src/get_last_with_len.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl<'tcx> LateLintPass<'tcx> for GetLastWithLen {
5858
// Argument 0 (the struct we're calling the method on) is a vector
5959
if let Some(struct_calling_on) = args.get(0);
6060
let struct_ty = cx.typeck_results().expr_ty(struct_calling_on);
61-
if is_type_diagnostic_item(cx, struct_ty, sym::vec_type);
61+
if is_type_diagnostic_item(cx, struct_ty, sym::Vec);
6262

6363
// Argument to "get" is a subtraction
6464
if let Some(get_index_arg) = args.get(1);

clippy_lints/src/if_let_mutex.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use rustc_hir::{Expr, ExprKind};
88
use rustc_lint::{LateContext, LateLintPass};
99
use rustc_middle::hir::map::Map;
1010
use rustc_session::{declare_lint_pass, declare_tool_lint};
11+
use rustc_span::sym;
1112

1213
declare_clippy_lint! {
1314
/// ### What it does
@@ -141,7 +142,7 @@ fn is_mutex_lock_call<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) -> Opt
141142
if let ExprKind::MethodCall(path, _span, [self_arg, ..], _) = &expr.kind;
142143
if path.ident.as_str() == "lock";
143144
let ty = cx.typeck_results().expr_ty(self_arg);
144-
if is_type_diagnostic_item(cx, ty, sym!(mutex_type));
145+
if is_type_diagnostic_item(cx, ty, sym::Mutex);
145146
then {
146147
Some(self_arg)
147148
} else {

clippy_lints/src/implicit_hasher.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,14 +225,14 @@ impl<'tcx> ImplicitHasherType<'tcx> {
225225

226226
let ty = hir_ty_to_ty(cx.tcx, hir_ty);
227227

228-
if is_type_diagnostic_item(cx, ty, sym::hashmap_type) && params_len == 2 {
228+
if is_type_diagnostic_item(cx, ty, sym::HashMap) && params_len == 2 {
229229
Some(ImplicitHasherType::HashMap(
230230
hir_ty.span,
231231
ty,
232232
snippet(cx, params[0].span, "K"),
233233
snippet(cx, params[1].span, "V"),
234234
))
235-
} else if is_type_diagnostic_item(cx, ty, sym::hashset_type) && params_len == 1 {
235+
} else if is_type_diagnostic_item(cx, ty, sym::HashSet) && params_len == 1 {
236236
Some(ImplicitHasherType::HashSet(
237237
hir_ty.span,
238238
ty,
@@ -347,7 +347,7 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for ImplicitHasherConstructorVisitor<'a, 'b, 't
347347
return;
348348
}
349349

350-
if self.cx.tcx.is_diagnostic_item(sym::hashmap_type, ty_did) {
350+
if self.cx.tcx.is_diagnostic_item(sym::HashMap, ty_did) {
351351
if method.ident.name == sym::new {
352352
self.suggestions
353353
.insert(e.span, "HashMap::default()".to_string());
@@ -360,7 +360,7 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for ImplicitHasherConstructorVisitor<'a, 'b, 't
360360
),
361361
);
362362
}
363-
} else if self.cx.tcx.is_diagnostic_item(sym::hashset_type, ty_did) {
363+
} else if self.cx.tcx.is_diagnostic_item(sym::HashSet, ty_did) {
364364
if method.ident.name == sym::new {
365365
self.suggestions
366366
.insert(e.span, "HashSet::default()".to_string());

clippy_lints/src/infinite_iter.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,11 +210,11 @@ const INFINITE_COLLECTORS: &[Symbol] = &[
210210
sym::BinaryHeap,
211211
sym::BTreeMap,
212212
sym::BTreeSet,
213-
sym::hashmap_type,
214-
sym::hashset_type,
213+
sym::HashMap,
214+
sym::HashSet,
215215
sym::LinkedList,
216-
sym::vec_type,
217-
sym::vecdeque_type,
216+
sym::Vec,
217+
sym::VecDeque,
218218
];
219219

220220
fn complete_infinite_iter(cx: &LateContext<'_>, expr: &Expr<'_>) -> Finiteness {

clippy_lints/src/inherent_to_string.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ impl<'tcx> LateLintPass<'tcx> for InherentToString {
111111
if impl_item.generics.params.is_empty();
112112

113113
// Check if return type is String
114-
if is_type_diagnostic_item(cx, return_ty(cx, impl_item.hir_id()), sym::string_type);
114+
if is_type_diagnostic_item(cx, return_ty(cx, impl_item.hir_id()), sym::String);
115115

116116
// Filters instances of to_string which are required by a trait
117117
if trait_ref_of_method(cx, impl_item.hir_id()).is_none();

clippy_lints/src/len_zero.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,10 +245,10 @@ enum LenOutput<'tcx> {
245245
fn parse_len_output(cx: &LateContext<'_>, sig: FnSig<'tcx>) -> Option<LenOutput<'tcx>> {
246246
match *sig.output().kind() {
247247
ty::Int(_) | ty::Uint(_) => Some(LenOutput::Integral),
248-
ty::Adt(adt, subs) if cx.tcx.is_diagnostic_item(sym::option_type, adt.did) => {
248+
ty::Adt(adt, subs) if cx.tcx.is_diagnostic_item(sym::Option, adt.did) => {
249249
subs.type_at(0).is_integral().then(|| LenOutput::Option(adt.did))
250250
},
251-
ty::Adt(adt, subs) if cx.tcx.is_diagnostic_item(sym::result_type, adt.did) => subs
251+
ty::Adt(adt, subs) if cx.tcx.is_diagnostic_item(sym::Result, adt.did) => subs
252252
.type_at(0)
253253
.is_integral()
254254
.then(|| LenOutput::Result(adt.did, subs.type_at(1))),

clippy_lints/src/loops/explicit_iter_loop.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ fn is_ref_iterable_type(cx: &LateContext<'_>, e: &Expr<'_>) -> bool {
5454
// will allow further borrows afterwards
5555
let ty = cx.typeck_results().expr_ty(e);
5656
is_iterable_array(ty, cx) ||
57-
is_type_diagnostic_item(cx, ty, sym::vec_type) ||
57+
is_type_diagnostic_item(cx, ty, sym::Vec) ||
5858
is_type_diagnostic_item(cx, ty, sym::LinkedList) ||
59-
is_type_diagnostic_item(cx, ty, sym::hashmap_type) ||
60-
is_type_diagnostic_item(cx, ty, sym::hashset_type) ||
61-
is_type_diagnostic_item(cx, ty, sym::vecdeque_type) ||
59+
is_type_diagnostic_item(cx, ty, sym::HashMap) ||
60+
is_type_diagnostic_item(cx, ty, sym::HashSet) ||
61+
is_type_diagnostic_item(cx, ty, sym::VecDeque) ||
6262
is_type_diagnostic_item(cx, ty, sym::BinaryHeap) ||
6363
is_type_diagnostic_item(cx, ty, sym::BTreeMap) ||
6464
is_type_diagnostic_item(cx, ty, sym::BTreeSet)

clippy_lints/src/loops/for_kv_map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, pat: &'tcx Pat<'_>, arg: &'tcx
3333
_ => arg,
3434
};
3535

36-
if is_type_diagnostic_item(cx, ty, sym::hashmap_type) || is_type_diagnostic_item(cx, ty, sym::BTreeMap) {
36+
if is_type_diagnostic_item(cx, ty, sym::HashMap) || is_type_diagnostic_item(cx, ty, sym::BTreeMap) {
3737
span_lint_and_then(
3838
cx,
3939
FOR_KV_MAP,

clippy_lints/src/loops/for_loops_over_fallibles.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc_span::symbol::sym;
99
/// Checks for `for` loops over `Option`s and `Result`s.
1010
pub(super) fn check(cx: &LateContext<'_>, pat: &Pat<'_>, arg: &Expr<'_>) {
1111
let ty = cx.typeck_results().expr_ty(arg);
12-
if is_type_diagnostic_item(cx, ty, sym::option_type) {
12+
if is_type_diagnostic_item(cx, ty, sym::Option) {
1313
span_lint_and_help(
1414
cx,
1515
FOR_LOOPS_OVER_FALLIBLES,
@@ -26,7 +26,7 @@ pub(super) fn check(cx: &LateContext<'_>, pat: &Pat<'_>, arg: &Expr<'_>) {
2626
snippet(cx, arg.span, "_")
2727
),
2828
);
29-
} else if is_type_diagnostic_item(cx, ty, sym::result_type) {
29+
} else if is_type_diagnostic_item(cx, ty, sym::Result) {
3030
span_lint_and_help(
3131
cx,
3232
FOR_LOOPS_OVER_FALLIBLES,

clippy_lints/src/loops/manual_memcpy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ fn is_slice_like<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'_>) -> bool {
332332
_ => false,
333333
};
334334

335-
is_slice || is_type_diagnostic_item(cx, ty, sym::vec_type) || is_type_diagnostic_item(cx, ty, sym::vecdeque_type)
335+
is_slice || is_type_diagnostic_item(cx, ty, sym::Vec) || is_type_diagnostic_item(cx, ty, sym::VecDeque)
336336
}
337337

338338
fn fetch_cloned_expr<'tcx>(expr: &'tcx Expr<'tcx>) -> &'tcx Expr<'tcx> {

clippy_lints/src/loops/needless_collect.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ fn check_needless_collect_direct_usage<'tcx>(expr: &'tcx Expr<'_>, cx: &LateCont
2929
let mut applicability = Applicability::MaybeIncorrect;
3030
let is_empty_sugg = "next().is_none()".to_string();
3131
let method_name = &*method.ident.name.as_str();
32-
let sugg = if is_type_diagnostic_item(cx, ty, sym::vec_type) ||
33-
is_type_diagnostic_item(cx, ty, sym::vecdeque_type) ||
32+
let sugg = if is_type_diagnostic_item(cx, ty, sym::Vec) ||
33+
is_type_diagnostic_item(cx, ty, sym::VecDeque) ||
3434
is_type_diagnostic_item(cx, ty, sym::LinkedList) ||
3535
is_type_diagnostic_item(cx, ty, sym::BinaryHeap) {
3636
match method_name {
@@ -47,7 +47,7 @@ fn check_needless_collect_direct_usage<'tcx>(expr: &'tcx Expr<'_>, cx: &LateCont
4747
}
4848
}
4949
else if is_type_diagnostic_item(cx, ty, sym::BTreeMap) ||
50-
is_type_diagnostic_item(cx, ty, sym::hashmap_type) {
50+
is_type_diagnostic_item(cx, ty, sym::HashMap) {
5151
match method_name {
5252
"is_empty" => is_empty_sugg,
5353
_ => return,
@@ -79,8 +79,8 @@ fn check_needless_collect_indirect_usage<'tcx>(expr: &'tcx Expr<'_>, cx: &LateCo
7979
if let ExprKind::MethodCall(method_name, collect_span, &[ref iter_source], ..) = init_expr.kind;
8080
if method_name.ident.name == sym!(collect) && is_trait_method(cx, init_expr, sym::Iterator);
8181
let ty = cx.typeck_results().expr_ty(init_expr);
82-
if is_type_diagnostic_item(cx, ty, sym::vec_type) ||
83-
is_type_diagnostic_item(cx, ty, sym::vecdeque_type) ||
82+
if is_type_diagnostic_item(cx, ty, sym::Vec) ||
83+
is_type_diagnostic_item(cx, ty, sym::VecDeque) ||
8484
is_type_diagnostic_item(cx, ty, sym::BinaryHeap) ||
8585
is_type_diagnostic_item(cx, ty, sym::LinkedList);
8686
if let Some(iter_calls) = detect_iter_and_into_iters(block, id);

clippy_lints/src/loops/same_item_push.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ fn get_vec_push<'tcx>(cx: &LateContext<'tcx>, stmt: &'tcx Stmt<'_>) -> Option<(&
192192
if let Some(self_expr) = args.get(0);
193193
if let Some(pushed_item) = args.get(1);
194194
// Check that the method being called is push() on a Vec
195-
if is_type_diagnostic_item(cx, cx.typeck_results().expr_ty(self_expr), sym::vec_type);
195+
if is_type_diagnostic_item(cx, cx.typeck_results().expr_ty(self_expr), sym::Vec);
196196
if path.ident.name.as_str() == "push";
197197
then {
198198
return Some((self_expr, pushed_item))

clippy_lints/src/manual_map.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ impl LateLintPass<'_> for ManualMap {
6161

6262
let (scrutinee_ty, ty_ref_count, ty_mutability) =
6363
peel_mid_ty_refs_is_mutable(cx.typeck_results().expr_ty(scrutinee));
64-
if !(is_type_diagnostic_item(cx, scrutinee_ty, sym::option_type)
65-
&& is_type_diagnostic_item(cx, cx.typeck_results().expr_ty(expr), sym::option_type))
64+
if !(is_type_diagnostic_item(cx, scrutinee_ty, sym::Option)
65+
&& is_type_diagnostic_item(cx, cx.typeck_results().expr_ty(expr), sym::Option))
6666
{
6767
return;
6868
}

clippy_lints/src/manual_ok_or.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ impl LateLintPass<'_> for ManualOkOr {
5151
if args.len() == 3;
5252
let method_receiver = &args[0];
5353
let ty = cx.typeck_results().expr_ty(method_receiver);
54-
if is_type_diagnostic_item(cx, ty, sym::option_type);
54+
if is_type_diagnostic_item(cx, ty, sym::Option);
5555
let or_expr = &args[1];
5656
if is_ok_wrapping(cx, &args[2]);
5757
if let ExprKind::Call(Expr { kind: ExprKind::Path(err_path), .. }, &[ref err_arg]) = or_expr.kind;

clippy_lints/src/manual_unwrap_or.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ fn lint_manual_unwrap_or<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) {
8282
if_chain! {
8383
if let ExprKind::Match(scrutinee, match_arms, _) = expr.kind;
8484
let ty = cx.typeck_results().expr_ty(scrutinee);
85-
if let Some(ty_name) = if is_type_diagnostic_item(cx, ty, sym::option_type) {
85+
if let Some(ty_name) = if is_type_diagnostic_item(cx, ty, sym::Option) {
8686
Some("Option")
87-
} else if is_type_diagnostic_item(cx, ty, sym::result_type) {
87+
} else if is_type_diagnostic_item(cx, ty, sym::Result) {
8888
Some("Result")
8989
} else {
9090
None

clippy_lints/src/map_clone.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl<'tcx> LateLintPass<'tcx> for MapClone {
5555
if args.len() == 2;
5656
if method.ident.name == sym::map;
5757
let ty = cx.typeck_results().expr_ty(&args[0]);
58-
if is_type_diagnostic_item(cx, ty, sym::option_type) || is_trait_method(cx, e, sym::Iterator);
58+
if is_type_diagnostic_item(cx, ty, sym::Option) || is_trait_method(cx, e, sym::Iterator);
5959
if let hir::ExprKind::Closure(_, _, body_id, _, _) = args[1].kind;
6060
then {
6161
let closure_body = cx.tcx.hir().body(body_id);

clippy_lints/src/map_unit_fn.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,9 @@ fn lint_map_unit_fn(cx: &LateContext<'_>, stmt: &hir::Stmt<'_>, expr: &hir::Expr
206206
let var_arg = &map_args[0];
207207

208208
let (map_type, variant, lint) =
209-
if is_type_diagnostic_item(cx, cx.typeck_results().expr_ty(var_arg), sym::option_type) {
209+
if is_type_diagnostic_item(cx, cx.typeck_results().expr_ty(var_arg), sym::Option) {
210210
("Option", "Some", OPTION_MAP_UNIT_FN)
211-
} else if is_type_diagnostic_item(cx, cx.typeck_results().expr_ty(var_arg), sym::result_type) {
211+
} else if is_type_diagnostic_item(cx, cx.typeck_results().expr_ty(var_arg), sym::Result) {
212212
("Result", "Ok", RESULT_MAP_UNIT_FN)
213213
} else {
214214
return;

clippy_lints/src/match_on_vec_items.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ fn is_vec_indexing<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) -> Opti
9393
fn is_vector(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
9494
let ty = cx.typeck_results().expr_ty(expr);
9595
let ty = ty.peel_refs();
96-
is_type_diagnostic_item(cx, ty, sym::vec_type)
96+
is_type_diagnostic_item(cx, ty, sym::Vec)
9797
}
9898

9999
fn is_full_range(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {

0 commit comments

Comments
 (0)