run cargo dev fmt

This commit is contained in:
Frank 2020-09-24 16:00:46 -05:00
parent f4d88cbb1f
commit e1b3f85e98
2 changed files with 8 additions and 9 deletions

View file

@ -1,9 +1,9 @@
use crate::utils::span_lint;
use rustc_data_structures::fx::FxHashSet;
use rustc_lint::{LateLintPass, LateContext};
use rustc_session::{impl_lint_pass, declare_tool_lint};
use rustc_hir::*;
use rustc_lint::{LateContext, LateLintPass};
use rustc_session::{declare_tool_lint, impl_lint_pass};
use rustc_span::Symbol;
declare_clippy_lint! {
@ -38,10 +38,9 @@ pub struct DisallowedMethod {
impl DisallowedMethod {
pub fn new(disallowed: FxHashSet<String>) -> Self {
Self {
disallowed: disallowed.iter()
.map(|s| {
s.split("::").map(|seg| Symbol::intern(seg)).collect::<Vec<_>>()
})
disallowed: disallowed
.iter()
.map(|s| s.split("::").map(|seg| Symbol::intern(seg)).collect::<Vec<_>>())
.collect(),
}
}
@ -49,7 +48,7 @@ impl DisallowedMethod {
impl_lint_pass!(DisallowedMethod => [DISALLOWED_METHOD]);
impl <'tcx> LateLintPass<'tcx> for DisallowedMethod {
impl<'tcx> LateLintPass<'tcx> for DisallowedMethod {
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
if let ExprKind::MethodCall(_path, _, _args, _) = &expr.kind {
let def_id = cx.typeck_results().type_dependent_def_id(expr.hir_id).unwrap();
@ -67,7 +66,7 @@ impl <'tcx> LateLintPass<'tcx> for DisallowedMethod {
.map(|s| s.to_ident_string())
.collect::<Vec<_>>()
.join("::"),
)
),
);
}
}

View file

@ -42,7 +42,7 @@ fn main() {
let f = Foo;
let c = ImplStruct;
let n = NormalStruct;
let a = AttrStruct{ bad_method: 5 };
let a = AttrStruct { bad_method: 5 };
// lint these
b.bad_method();