]> git.lizzy.rs Git - rust.git/commitdiff
Make lint skip closures
authorHirochika Matsumoto <matsujika@gmail.com>
Sun, 18 Oct 2020 07:30:46 +0000 (16:30 +0900)
committerHirochika Matsumoto <matsujika@gmail.com>
Tue, 17 Nov 2020 16:28:37 +0000 (01:28 +0900)
clippy_lints/src/unnecessary_wrap.rs

index fc1a33fc6cd7f5887f355e36bda7433fafe019e1..a20d1f82e9efd1fda9355204251e334b4775954d 100644 (file)
@@ -63,12 +63,10 @@ fn check_fn(
         span: Span,
         hir_id: HirId,
     ) {
-        if_chain! {
-            if let FnKind::ItemFn(.., visibility, _) = fn_kind;
-            if visibility.node.is_pub();
-            then {
-                return;
-            }
+        match fn_kind {
+            FnKind::ItemFn(.., visibility, _) if visibility.node.is_pub() => return,
+            FnKind::Closure(..) => return,
+            _ => (),
         }
 
         let (return_type, path) = if is_type_diagnostic_item(cx, return_ty(cx, hir_id), sym!(option_type)) {