diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-08-02 07:30:43 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-02 07:30:43 +0200 |
| commit | 17f76a16f9379aaf10c656e23a2d132fcb17a751 (patch) | |
| tree | 9075e9a875ebea842529510da3e01367247df172 | |
| parent | 96908527cafd0ea0c8bb9df138e1688fcf3edb0d (diff) | |
| parent | a3c2d5535658bed3b8fbe924ec64f6cfa5ec96c4 (diff) | |
| download | rust-17f76a16f9379aaf10c656e23a2d132fcb17a751.tar.gz rust-17f76a16f9379aaf10c656e23a2d132fcb17a751.zip | |
Rollup merge of #99994 - TaKO8Ki:remove-guess-head-span, r=fee1-dead
Remove `guess_head_span` follow-up to #98519
| -rw-r--r-- | compiler/rustc_typeck/src/check/_match.rs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/compiler/rustc_typeck/src/check/_match.rs b/compiler/rustc_typeck/src/check/_match.rs index 4f15592e6fb..1b13c98e4c3 100644 --- a/compiler/rustc_typeck/src/check/_match.rs +++ b/compiler/rustc_typeck/src/check/_match.rs @@ -356,13 +356,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // 6 | | }; // | |_____^ expected integer, found `()` // ``` - if block.expr.is_none() && block.stmts.is_empty() && outer_span.is_some() { - let sp = if let Some(cs) = cond_span.find_ancestor_inside(span) { - span.with_hi(cs.hi()) - } else { - span - }; - outer_span = Some(sp); + if block.expr.is_none() && block.stmts.is_empty() + && let Some(outer_span) = &mut outer_span + && let Some(cond_span) = cond_span.find_ancestor_inside(*outer_span) + { + *outer_span = outer_span.with_hi(cond_span.hi()) } (self.find_block_span(block), block.hir_id) |
