about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTakayuki Maeda <takoyaki0316@gmail.com>2022-08-01 12:01:53 +0900
committerTakayuki Maeda <takoyaki0316@gmail.com>2022-08-02 11:40:23 +0900
commita3c2d5535658bed3b8fbe924ec64f6cfa5ec96c4 (patch)
treea8ab7e27d7d858fa76885272bc3e11005f454768
parent21de280cccb4eb02ead6bf0af40e2355a9136d6f (diff)
downloadrust-a3c2d5535658bed3b8fbe924ec64f6cfa5ec96c4.tar.gz
rust-a3c2d5535658bed3b8fbe924ec64f6cfa5ec96c4.zip
remove a `SourceMap::guess_head_span`
-rw-r--r--compiler/rustc_typeck/src/check/_match.rs12
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)