]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/clippy_lints/src/misc_early/builtin_type_shadow.rs
Rollup merge of #85760 - ChrisDenton:path-doc-platform-specific, r=m-ou-se
[rust.git] / src / tools / clippy / clippy_lints / src / misc_early / builtin_type_shadow.rs
1 use clippy_utils::diagnostics::span_lint;
2 use rustc_ast::ast::{GenericParam, GenericParamKind};
3 use rustc_hir::PrimTy;
4 use rustc_lint::EarlyContext;
5
6 use super::BUILTIN_TYPE_SHADOW;
7
8 pub(super) fn check(cx: &EarlyContext<'_>, param: &GenericParam) {
9     if let GenericParamKind::Type { .. } = param.kind {
10         if let Some(prim_ty) = PrimTy::from_name(param.ident.name) {
11             span_lint(
12                 cx,
13                 BUILTIN_TYPE_SHADOW,
14                 param.ident.span,
15                 &format!("this generic shadows the built-in type `{}`", prim_ty.name()),
16             );
17         }
18     }
19 }