update error message, refactor disallowed_method

This commit is contained in:
Frank
2020-09-25 09:38:19 -05:00
parent 3886edb05a
commit f9da2946d8
3 changed files with 13 additions and 14 deletions

View File

@@ -27,7 +27,7 @@ declare_clippy_lint! {
/// ```
pub DISALLOWED_METHOD,
nursery,
"used disallowed method call"
"use of a disallowed method call"
}
#[derive(Clone, Debug)]
@@ -55,18 +55,17 @@ impl<'tcx> LateLintPass<'tcx> for DisallowedMethod {
let method_call = cx.get_def_path(def_id);
if self.disallowed.contains(&method_call) {
let method = method_call
.iter()
.map(|s| s.to_ident_string())
.collect::<Vec<_>>()
.join("::");
span_lint(
cx,
DISALLOWED_METHOD,
expr.span,
&format!(
"Use of a disallowed method `{}`",
method_call
.iter()
.map(|s| s.to_ident_string())
.collect::<Vec<_>>()
.join("::"),
),
&format!("use of a disallowed method `{}`", method),
);
}
}