Skip to content

Commit ed85b61

Browse files
committed
clippy
1 parent f274f2c commit ed85b61

File tree

1 file changed

+5
-10
lines changed
  • crates/ruff_linter/src/rules/flake8_return/rules

1 file changed

+5
-10
lines changed

crates/ruff_linter/src/rules/flake8_return/rules/function.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ fn add_return_none(checker: &Checker, stmt: &Stmt, range: TextRange) {
462462
}
463463
}
464464

465-
fn has_implicit_return<'a>(checker: &Checker, stmt: &'a Stmt) -> bool {
465+
fn has_implicit_return(checker: &Checker, stmt: &Stmt) -> bool {
466466
match stmt {
467467
Stmt::If(ast::StmtIf {
468468
body,
@@ -486,21 +486,18 @@ fn has_implicit_return<'a>(checker: &Checker, stmt: &'a Stmt) -> bool {
486486
}
487487

488488
// Check if we don't have an else clause
489-
if matches!(
489+
matches!(
490490
elif_else_clauses.last(),
491491
None | Some(ast::ElifElseClause { test: Some(_), .. })
492-
) {
493-
return true;
494-
}
495-
false
492+
)
496493
}
497494
Stmt::Assert(ast::StmtAssert { test, .. }) if is_const_false(test) => false,
498495
Stmt::While(ast::StmtWhile { test, .. }) if is_const_true(test) => false,
499496
Stmt::For(ast::StmtFor { orelse, .. }) | Stmt::While(ast::StmtWhile { orelse, .. }) => {
500497
if let Some(last_stmt) = orelse.last() {
501498
has_implicit_return(checker, last_stmt)
502499
} else {
503-
return true;
500+
true
504501
}
505502
}
506503
Stmt::Match(ast::StmtMatch { cases, .. }) => cases.iter().any(|case| {
@@ -521,9 +518,7 @@ fn has_implicit_return<'a>(checker: &Checker, stmt: &'a Stmt) -> bool {
521518
{
522519
false
523520
}
524-
_ => {
525-
return true;
526-
}
521+
_ => true,
527522
}
528523
}
529524

0 commit comments

Comments
 (0)