diff --git a/clippy_lints/src/unnecessary_wrap.rs b/clippy_lints/src/unnecessary_wrap.rs index fc1a33fc6..a20d1f82e 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)) {