From a3c2d5535658bed3b8fbe924ec64f6cfa5ec96c4 Mon Sep 17 00:00:00 2001 From: Takayuki Maeda Date: Mon, 1 Aug 2022 12:01:53 +0900 Subject: [PATCH] remove a `SourceMap::guess_head_span` --- compiler/rustc_typeck/src/check/_match.rs | 12 +++++------- 1 file 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 @@ pub(crate) fn if_cause( // 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)