Rollup merge of #99994 - TaKO8Ki:remove-guess-head-span, r=fee1-dead

Remove `guess_head_span`

follow-up to #98519
This commit is contained in:
Matthias Krüger 2022-08-02 07:30:43 +02:00 committed by GitHub
commit 17f76a16f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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)