return when expr has errors

add ui tests
This commit is contained in:
Takayuki Maeda 2022-11-15 16:44:23 +09:00
parent 061610640c
commit 1cf4132a16
3 changed files with 43 additions and 0 deletions

View file

@ -518,6 +518,11 @@ trait UnusedDelimLint {
) {
let spans = match value.kind {
ast::ExprKind::Block(ref block, None) if block.stmts.len() == 1 => {
if let StmtKind::Expr(expr) = &block.stmts[0].kind
&& let ExprKind::Err = expr.kind
{
return
}
if let Some(span) = block.stmts[0].span.find_ancestor_inside(value.span) {
Some((value.span.with_hi(span.lo()), value.span.with_lo(span.hi())))
} else {