]> git.lizzy.rs Git - rust.git/commitdiff
run cargo dev fmt
authorFrank <lifrank@grinnell.edu>
Thu, 24 Sep 2020 21:00:46 +0000 (16:00 -0500)
committerFrank <lifrank@grinnell.edu>
Fri, 25 Sep 2020 16:09:04 +0000 (11:09 -0500)
clippy_lints/src/disallowed_method.rs
tests/ui/disallowed_method.rs

index 5ecdcc0e08aa1d21051b2979a0eab39a2378355e..42fbff8ff879dd3b005bb8078258ee47bd6e3bdb 100644 (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 @@ pub fn new(disallowed: FxHashSet<String>) -> Self {
 
 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 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
                             .map(|s| s.to_ident_string())
                             .collect::<Vec<_>>()
                             .join("::"),
-                    )
+                    ),
                 );
             }
         }
index a54a04b4d2c664f37f170055d7bb34d6ba0a461e..46c9185268c6806d9fc9f8a91921abdc905c0442 100644 (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();