From 7a5ede677b7642f098fd5fd69272c742d13e4ea4 Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Mon, 6 Aug 2018 15:42:08 +0200 Subject: [PATCH] Use Option::map_or --- clippy_lints/src/mem_forget.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/clippy_lints/src/mem_forget.rs b/clippy_lints/src/mem_forget.rs index 88c24458646..80130de15d7 100644 --- a/clippy_lints/src/mem_forget.rs +++ b/clippy_lints/src/mem_forget.rs @@ -37,10 +37,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MemForget { if match_def_path(cx.tcx, def_id, &paths::MEM_FORGET) { let forgot_ty = cx.tables.expr_ty(&args[0]); - if match forgot_ty.ty_adt_def() { - Some(def) => def.has_dtor(cx.tcx), - _ => false, - } { + if forgot_ty.ty_adt_def().map_or(false, |def| def.has_dtor(cx.tcx)) { span_lint(cx, MEM_FORGET, e.span, "usage of mem::forget on Drop type"); } }