Skip to content

Commit 7dceff9

Browse files
committed
typeck: remove redundant diverges check
1 parent 1240a31 commit 7dceff9

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/librustc_typeck/check/_match.rs

+8-10
Original file line numberDiff line numberDiff line change
@@ -183,16 +183,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
183183
arms: &'tcx [hir::Arm<'tcx>],
184184
source: hir::MatchSource,
185185
) {
186-
if self.diverges.get().is_always() {
187-
use hir::MatchSource::*;
188-
let msg = match source {
189-
IfDesugar { .. } | IfLetDesugar { .. } => "block in `if` expression",
190-
WhileDesugar { .. } | WhileLetDesugar { .. } => "block in `while` expression",
191-
_ => "arm",
192-
};
193-
for arm in arms {
194-
self.warn_if_unreachable(arm.body.hir_id, arm.body.span, msg);
195-
}
186+
use hir::MatchSource::*;
187+
let msg = match source {
188+
IfDesugar { .. } | IfLetDesugar { .. } => "block in `if` expression",
189+
WhileDesugar { .. } | WhileLetDesugar { .. } => "block in `while` expression",
190+
_ => "arm",
191+
};
192+
for arm in arms {
193+
self.warn_if_unreachable(arm.body.hir_id, arm.body.span, msg);
196194
}
197195
}
198196

0 commit comments

Comments
 (0)