5 /// **What it does:** Checks for usage of blacklisted names for variables, such
8 /// **Why is this bad?** These names are usually placeholder names and should be
11 /// **Known problems:** None.
20 "usage of a blacklisted/placeholder name"
23 #[derive(Clone, Debug)]
24 pub struct BlackListedName {
25 blacklist: Vec<String>,
28 impl BlackListedName {
29 pub fn new(blacklist: Vec<String>) -> Self {
36 impl LintPass for BlackListedName {
37 fn get_lints(&self) -> LintArray {
38 lint_array!(BLACKLISTED_NAME)
42 impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BlackListedName {
43 fn check_pat(&mut self, cx: &LateContext<'a, 'tcx>, pat: &'tcx Pat) {
44 if let PatKind::Binding(_, _, ref ident, _) = pat.node {
45 if self.blacklist.iter().any(|s| ident.node == *s) {
50 &format!("use of a blacklisted/placeholder name `{}`", ident.node),