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>) -> BlackListedName {
30 BlackListedName { blacklist: blacklist }
34 impl LintPass for BlackListedName {
35 fn get_lints(&self) -> LintArray {
36 lint_array!(BLACKLISTED_NAME)
40 impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BlackListedName {
41 fn check_pat(&mut self, cx: &LateContext<'a, 'tcx>, pat: &'tcx Pat) {
42 if let PatKind::Binding(_, _, ref ident, _) = pat.node {
43 if self.blacklist.iter().any(|s| ident.node == *s) {
48 &format!("use of a blacklisted/placeholder name `{}`", ident.node),