5 /// **What it does:** This lints about usage of blacklisted names.
7 /// **Why is this bad?** These names are usually placeholder names and should be avoided.
9 /// **Known problems:** None.
11 /// **Example:** `let foo = 3.14;`
15 "usage of a blacklisted/placeholder name"
18 #[derive(Clone, Debug)]
19 pub struct BlackListedName {
20 blacklist: Vec<String>,
23 impl BlackListedName {
24 pub fn new(blacklist: Vec<String>) -> BlackListedName {
25 BlackListedName { blacklist: blacklist }
29 impl LintPass for BlackListedName {
30 fn get_lints(&self) -> LintArray {
31 lint_array!(BLACKLISTED_NAME)
35 impl LateLintPass for BlackListedName {
36 fn check_pat(&mut self, cx: &LateContext, pat: &Pat) {
37 if let PatKind::Binding(_, ref ident, _) = pat.node {
38 if self.blacklist.iter().any(|s| s == &*ident.node.as_str()) {
42 &format!("use of a blacklisted/placeholder name `{}`", ident.node));