check only first statement

This commit is contained in:
kyoto7250 2022-06-18 17:49:03 +09:00
parent f411c18a73
commit 7a83809c8c
2 changed files with 7 additions and 37 deletions

View File

@ -372,11 +372,13 @@ fn eq_stmts(
}
fn contains_acceptable_macro(cx: &LateContext<'_>, block: &Block<'_>) -> bool {
for stmt in block.stmts {
match stmt.kind {
StmtKind::Semi(semi_expr) if acceptable_macro(cx, semi_expr) => return true,
_ => {},
}
if block.stmts.first().map_or(false, |stmt|
matches!(
stmt.kind,
StmtKind::Semi(semi_expr) if acceptable_macro(cx, semi_expr)
)
) {
return true;
}
if let Some(block_expr) = block.expr

View File

@ -179,38 +179,6 @@ 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!()
}
}
}