X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=clippy_lints%2Fsrc%2Fblacklisted_name.rs;h=29660399233038f7f33fb3bfcd9639329b2c04d4;hb=48cb6e273ea49e85b6baa209e0123a2bbd6d15c2;hp=e46d8e4855f67b71a9a04c7aeffd5d1d22155d0c;hpb=992d88ab582ecc9e0415dc28e2dadd32fb49ed12;p=rust.git diff --git a/clippy_lints/src/blacklisted_name.rs b/clippy_lints/src/blacklisted_name.rs index e46d8e4855f..29660399233 100644 --- a/clippy_lints/src/blacklisted_name.rs +++ b/clippy_lints/src/blacklisted_name.rs @@ -1,6 +1,6 @@ use rustc::lint::*; use rustc::hir::*; -use utils::span_lint; +use crate::utils::span_lint; /// **What it does:** Checks for usage of blacklisted names for variables, such /// as `foo`. @@ -14,9 +14,9 @@ /// ```rust /// let foo = 3.14; /// ``` -declare_lint! { +declare_clippy_lint! { pub BLACKLISTED_NAME, - Warn, + style, "usage of a blacklisted/placeholder name" } @@ -27,7 +27,9 @@ pub struct BlackListedName { impl BlackListedName { pub fn new(blacklist: Vec) -> Self { - Self { blacklist: blacklist } + Self { + blacklist, + } } } @@ -39,13 +41,13 @@ fn get_lints(&self) -> LintArray { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BlackListedName { fn check_pat(&mut self, cx: &LateContext<'a, 'tcx>, pat: &'tcx Pat) { - if let PatKind::Binding(_, _, ref ident, _) = pat.node { - if self.blacklist.iter().any(|s| ident.node == *s) { + if let PatKind::Binding(_, _, ident, _) = pat.node { + if self.blacklist.iter().any(|s| ident.name == *s) { span_lint( cx, BLACKLISTED_NAME, ident.span, - &format!("use of a blacklisted/placeholder name `{}`", ident.node), + &format!("use of a blacklisted/placeholder name `{}`", ident.name), ); } }