We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8aafe8c commit d547843Copy full SHA for d547843
clippy_lints/src/question_mark.rs
@@ -208,11 +208,7 @@ fn expr_return_none_or_err(
208
fn requires_semi(if_then: &Expr<'_>, if_else: Option<&Expr<'_>>) -> bool {
209
let if_then_kind = &peel_blocks_with_stmt(if_then).kind;
210
let if_then_is_ret_stmt = matches!(if_then_kind, ExprKind::Ret(..));
211
-
212
- if if_else.is_none() {
213
- return if_then_is_ret_stmt;
214
- }
215
- if let ExprKind::Ret(_) = peel_blocks_with_stmt(if_else.unwrap()).kind {
+ if if_else.is_none() || matches!(peel_blocks_with_stmt(if_else.unwrap()).kind, ExprKind::Ret(_)) {
216
return if_then_is_ret_stmt;
217
}
218
false
0 commit comments