diff options
| author | Cameron Steffen <cam.steffen94@gmail.com> | 2021-10-02 18:51:01 -0500 | 
|---|---|---|
| committer | Cameron Steffen <cam.steffen94@gmail.com> | 2021-10-02 19:38:19 -0500 | 
| commit | eec856bfbcd79d12352f81b44a9f04e5bb06bda5 (patch) | |
| tree | de49e7a7c12ca371082c5ff3356eb271853cc5bb /compiler/rustc_lint/src | |
| parent | f03eb6bef8ced8a243858b819e013b9caf83d757 (diff) | |
| download | rust-eec856bfbcd79d12352f81b44a9f04e5bb06bda5.tar.gz rust-eec856bfbcd79d12352f81b44a9f04e5bb06bda5.zip | |
Make diangostic item names consistent
Diffstat (limited to 'compiler/rustc_lint/src')
| -rw-r--r-- | compiler/rustc_lint/src/builtin.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_lint/src/internal.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_lint/src/methods.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_lint/src/non_fmt_panic.rs | 6 | 
4 files changed, 7 insertions, 7 deletions
| diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs index 4513c8329ca..9b6493222e6 100644 --- a/compiler/rustc_lint/src/builtin.rs +++ b/compiler/rustc_lint/src/builtin.rs @@ -812,7 +812,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingDebugImplementations { _ => return, } - let debug = match cx.tcx.get_diagnostic_item(sym::debug_trait) { + let debug = match cx.tcx.get_diagnostic_item(sym::Debug) { Some(debug) => debug, None => return, }; diff --git a/compiler/rustc_lint/src/internal.rs b/compiler/rustc_lint/src/internal.rs index 8a4a7089437..a4940e5aae7 100644 --- a/compiler/rustc_lint/src/internal.rs +++ b/compiler/rustc_lint/src/internal.rs @@ -33,9 +33,9 @@ impl LateLintPass<'_> for DefaultHashTypes { // don't lint imports, only actual usages return; } - let replace = if cx.tcx.is_diagnostic_item(sym::hashmap_type, def_id) { + let replace = if cx.tcx.is_diagnostic_item(sym::HashMap, def_id) { "FxHashMap" - } else if cx.tcx.is_diagnostic_item(sym::hashset_type, def_id) { + } else if cx.tcx.is_diagnostic_item(sym::HashSet, def_id) { "FxHashSet" } else { return; diff --git a/compiler/rustc_lint/src/methods.rs b/compiler/rustc_lint/src/methods.rs index 8732845af0c..5558947de0c 100644 --- a/compiler/rustc_lint/src/methods.rs +++ b/compiler/rustc_lint/src/methods.rs @@ -84,7 +84,7 @@ fn lint_cstring_as_ptr( ) { let source_type = cx.typeck_results().expr_ty(source); if let ty::Adt(def, substs) = source_type.kind() { - if cx.tcx.is_diagnostic_item(sym::result_type, def.did) { + if cx.tcx.is_diagnostic_item(sym::Result, def.did) { if let ty::Adt(adt, _) = substs.type_at(0).kind() { if cx.tcx.is_diagnostic_item(sym::cstring_type, adt.did) { cx.struct_span_lint(TEMPORARY_CSTRING_AS_PTR, as_ptr_span, |diag| { diff --git a/compiler/rustc_lint/src/non_fmt_panic.rs b/compiler/rustc_lint/src/non_fmt_panic.rs index ae9c5ce5c3c..b945c764320 100644 --- a/compiler/rustc_lint/src/non_fmt_panic.rs +++ b/compiler/rustc_lint/src/non_fmt_panic.rs @@ -130,14 +130,14 @@ fn check_panic<'tcx>(cx: &LateContext<'tcx>, f: &'tcx hir::Expr<'tcx>, arg: &'tc ty::Ref(_, r, _) if *r.kind() == ty::Str, ) || matches!( ty.ty_adt_def(), - Some(ty_def) if cx.tcx.is_diagnostic_item(sym::string_type, ty_def.did), + Some(ty_def) if cx.tcx.is_diagnostic_item(sym::String, ty_def.did), ); let (suggest_display, suggest_debug) = cx.tcx.infer_ctxt().enter(|infcx| { - let display = is_str || cx.tcx.get_diagnostic_item(sym::display_trait).map(|t| { + let display = is_str || cx.tcx.get_diagnostic_item(sym::Display).map(|t| { infcx.type_implements_trait(t, ty, InternalSubsts::empty(), cx.param_env).may_apply() }) == Some(true); - let debug = !display && cx.tcx.get_diagnostic_item(sym::debug_trait).map(|t| { + let debug = !display && cx.tcx.get_diagnostic_item(sym::Debug).map(|t| { infcx.type_implements_trait(t, ty, InternalSubsts::empty(), cx.param_env).may_apply() }) == Some(true); (display, debug) | 
