remove a SourceMap::guess_head_span

This commit is contained in:
Takayuki Maeda 2022-08-01 12:01:53 +09:00
parent 21de280ccc
commit a3c2d55356

View File

@ -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)