check last statement

This commit is contained in:
kyoto7250 2022-06-20 11:05:40 +09:00
parent 4a02ae9636
commit 46d056e2eb
2 changed files with 33 additions and 1 deletions

View File

@ -88,7 +88,7 @@ impl<'a, 'tcx> SpanlessEq<'a, 'tcx> {
}
fn cannot_be_compared_block(&mut self, block: &Block<'_>) -> bool {
if block.stmts.first().map_or(false, |stmt| {
if block.stmts.last().map_or(false, |stmt| {
matches!(
stmt.kind,
StmtKind::Semi(semi_expr) if self.should_ignore(semi_expr)

View File

@ -179,6 +179,38 @@ mod issue_8836 {
} else {
unimplemented!();
}
if true {
println!("FOO");
todo!();
} else {
println!("FOO");
todo!();
}
if true {
println!("FOO");
unimplemented!();
} else {
println!("FOO");
unimplemented!();
}
if true {
println!("FOO");
todo!()
} else {
println!("FOO");
todo!()
}
if true {
println!("FOO");
unimplemented!()
} else {
println!("FOO");
unimplemented!()
}
}
}