Skip to content

Commit 41e1128

Browse files
committed
Use 'if let' instead of 'match'
1 parent a8ce93e commit 41e1128

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

src/librustc_typeck/check/_match.rs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -173,17 +173,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
173173
// we can emit a better note. Rather than pointing
174174
// at a diverging expression in an arbitrary arm,
175175
// we can point at the entire `match` expression
176-
match (all_arms_diverge, match_src) {
177-
(Diverges::Always { .. }, hir::MatchSource::Normal) => {
178-
all_arms_diverge = Diverges::Always {
179-
span: expr.span,
180-
custom_note: Some(
181-
"any code following this `match` expression is unreachable, \
182-
as all arms diverge"
183-
)
184-
};
185-
},
186-
_ => {}
176+
if let (Diverges::Always { .. }, hir::MatchSource::Normal) = (all_arms_diverge, match_src) {
177+
all_arms_diverge = Diverges::Always {
178+
span: expr.span,
179+
custom_note: Some(
180+
"any code following this `match` expression is unreachable, as all arms diverge"
181+
)
182+
};
187183
}
188184

189185
// We won't diverge unless the discriminant or all arms diverge.

0 commit comments

Comments
 (0)