Skip to content

Commit 7702555

Browse files
authored
Merge pull request #3009 from dwijnand/option-map_or
Use Option::map_or
2 parents 1af9008 + 7a5ede6 commit 7702555

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

clippy_lints/src/mem_forget.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MemForget {
3737
if match_def_path(cx.tcx, def_id, &paths::MEM_FORGET) {
3838
let forgot_ty = cx.tables.expr_ty(&args[0]);
3939

40-
if match forgot_ty.ty_adt_def() {
41-
Some(def) => def.has_dtor(cx.tcx),
42-
_ => false,
43-
} {
40+
if forgot_ty.ty_adt_def().map_or(false, |def| def.has_dtor(cx.tcx)) {
4441
span_lint(cx, MEM_FORGET, e.span, "usage of mem::forget on Drop type");
4542
}
4643
}

0 commit comments

Comments
 (0)