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.
18 "usage of a blacklisted/placeholder name"
21 #[derive(Clone, Debug)]
22 pub struct BlackListedName {
23 blacklist: Vec<String>,
26 impl BlackListedName {
27 pub fn new(blacklist: Vec<String>) -> BlackListedName {
28 BlackListedName { blacklist: blacklist }
32 impl LintPass for BlackListedName {
33 fn get_lints(&self) -> LintArray {
34 lint_array!(BLACKLISTED_NAME)
38 impl LateLintPass for BlackListedName {
39 fn check_pat(&mut self, cx: &LateContext, pat: &Pat) {
40 if let PatKind::Binding(_, ref ident, _) = pat.node {
41 if self.blacklist.iter().any(|s| s == &*ident.node.as_str()) {
45 &format!("use of a blacklisted/placeholder name `{}`", ident.node));