diff options
| author | Takayuki Maeda <takoyaki0316@gmail.com> | 2022-08-01 12:01:53 +0900 |
|---|---|---|
| committer | Takayuki Maeda <takoyaki0316@gmail.com> | 2022-08-02 11:40:23 +0900 |
| commit | a3c2d5535658bed3b8fbe924ec64f6cfa5ec96c4 (patch) | |
| tree | a8ab7e27d7d858fa76885272bc3e11005f454768 | |
| parent | 21de280cccb4eb02ead6bf0af40e2355a9136d6f (diff) | |
| download | rust-a3c2d5535658bed3b8fbe924ec64f6cfa5ec96c4.tar.gz rust-a3c2d5535658bed3b8fbe924ec64f6cfa5ec96c4.zip | |
remove a `SourceMap::guess_head_span`
| -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) |
