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);

0 commit comments

Comments
 (0)