about summary refs log tree commit diff
diff options
context:
space:
mode:
authorHirochika Matsumoto <matsujika@gmail.com>2020-10-18 16:30:46 +0900
committerHirochika Matsumoto <matsujika@gmail.com>2020-11-18 01:28:37 +0900
commit2f85aa736e85544803ff6d3e6b13e44c0729bbdd (patch)
tree502d4d2fb6a8abd8a56d6758ed6d31aa2d936f56
parent8392bc7946a212a85bc5a411f5321a1f76d5ccf6 (diff)
downloadrust-2f85aa736e85544803ff6d3e6b13e44c0729bbdd.tar.gz
rust-2f85aa736e85544803ff6d3e6b13e44c0729bbdd.zip
Make lint skip closures
-rw-r--r--clippy_lints/src/unnecessary_wrap.rs10
1 files changed, 4 insertions, 6 deletions
diff --git a/clippy_lints/src/unnecessary_wrap.rs b/clippy_lints/src/unnecessary_wrap.rs
index fc1a33fc6cd..a20d1f82e9e 100644
--- a/clippy_lints/src/unnecessary_wrap.rs
+++ b/clippy_lints/src/unnecessary_wrap.rs
@@ -63,12 +63,10 @@ impl<'tcx> LateLintPass<'tcx> for UnnecessaryWrap {
         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)) {