Skip to content

Commit 55bda11

Browse files
committed
drive-by-cleanup: merge an early return into a match
1 parent 63b1db0 commit 55bda11

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

compiler/rustc_lint/src/unused.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,11 +291,9 @@ impl<'tcx> LateLintPass<'tcx> for UnusedResults {
291291
let parent_mod_did = cx.tcx.parent_module(expr.hir_id).to_def_id();
292292
let is_uninhabited =
293293
|t: Ty<'tcx>| !t.is_inhabited_from(cx.tcx, parent_mod_did, cx.typing_env());
294-
if is_uninhabited(ty) {
295-
return Some(MustUsePath::Suppressed);
296-
}
297294

298295
match *ty.kind() {
296+
_ if is_uninhabited(ty) => Some(MustUsePath::Suppressed),
299297
ty::Adt(..) if let Some(boxed) = ty.boxed_ty() => {
300298
is_ty_must_use(cx, boxed, expr, span)
301299
.map(|inner| MustUsePath::Boxed(Box::new(inner)))

0 commit comments

Comments
 (0)