about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--clippy_lints/src/misc_early.rs8
-rw-r--r--clippy_lints/src/utils/constants.rs13
-rw-r--r--clippy_lints/src/utils/mod.rs1
3 files changed, 4 insertions, 18 deletions
diff --git a/clippy_lints/src/misc_early.rs b/clippy_lints/src/misc_early.rs
index 5bc45c87874..84a0df92f5b 100644
--- a/clippy_lints/src/misc_early.rs
+++ b/clippy_lints/src/misc_early.rs
@@ -1,4 +1,4 @@
-use crate::utils::{constants, snippet_opt, span_lint, span_lint_and_help, span_lint_and_sugg, span_lint_and_then};
+use crate::utils::{snippet_opt, span_lint, span_lint_and_help, span_lint_and_sugg, span_lint_and_then};
 use rustc_ast::ast::{
     BindingMode, Expr, ExprKind, GenericParamKind, Generics, Lit, LitFloatType, LitIntType, LitKind, Mutability,
     NodeId, Pat, PatKind, UnOp,
@@ -6,6 +6,7 @@ use rustc_ast::ast::{
 use rustc_ast::visit::FnKind;
 use rustc_data_structures::fx::FxHashMap;
 use rustc_errors::Applicability;
+use rustc_hir::PrimTy;
 use rustc_lint::{EarlyContext, EarlyLintPass, LintContext};
 use rustc_middle::lint::in_external_macro;
 use rustc_session::{declare_lint_pass, declare_tool_lint};
@@ -264,13 +265,12 @@ impl EarlyLintPass for MiscEarlyLints {
     fn check_generics(&mut self, cx: &EarlyContext<'_>, gen: &Generics) {
         for param in &gen.params {
             if let GenericParamKind::Type { .. } = param.kind {
-                let name = param.ident.as_str();
-                if constants::BUILTIN_TYPES.contains(&&*name) {
+                if let Some(prim_ty) = PrimTy::from_name(param.ident.name) {
                     span_lint(
                         cx,
                         BUILTIN_TYPE_SHADOW,
                         param.ident.span,
-                        &format!("this generic shadows the built-in type `{}`", name),
+                        &format!("this generic shadows the built-in type `{}`", prim_ty.name()),
                     );
                 }
             }
diff --git a/clippy_lints/src/utils/constants.rs b/clippy_lints/src/utils/constants.rs
deleted file mode 100644
index 522932f054d..00000000000
--- a/clippy_lints/src/utils/constants.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-//! This module contains some useful constants.
-
-#![deny(clippy::missing_docs_in_private_items)]
-
-/// List of the built-in types names.
-///
-/// See also [the reference][reference-types] for a list of such types.
-///
-/// [reference-types]: https://doc.rust-lang.org/reference/types.html
-pub const BUILTIN_TYPES: &[&str] = &[
-    "i8", "u8", "i16", "u16", "i32", "u32", "i64", "u64", "i128", "u128", "isize", "usize", "f32", "f64", "bool",
-    "str", "char",
-];
diff --git a/clippy_lints/src/utils/mod.rs b/clippy_lints/src/utils/mod.rs
index d0db3a67533..e639d33ed47 100644
--- a/clippy_lints/src/utils/mod.rs
+++ b/clippy_lints/src/utils/mod.rs
@@ -8,7 +8,6 @@ pub mod author;
 pub mod camel_case;
 pub mod comparisons;
 pub mod conf;
-pub mod constants;
 mod diagnostics;
 pub mod eager_or_lazy;
 pub mod higher;