Skip to content

Commit a1a399d

Browse files
committed
Fix question_mark FP on calls
1 parent d4196d0 commit a1a399d

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

clippy_lints/src/question_mark.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -172,23 +172,17 @@ impl QuestionMark {
172172
}
173173
}
174174

175-
fn expression_returns_unmodified_err(
176-
cx: &LateContext<'_>,
177-
expression: &Expr<'_>,
178-
origin_hir_id: &Expr<'_>,
179-
) -> bool {
175+
fn expression_returns_unmodified_err(cx: &LateContext<'_>, expression: &Expr<'_>, cond_expr: &Expr<'_>) -> bool {
180176
match expression.kind {
181177
ExprKind::Block(block, _) => {
182178
if let Some(return_expression) = Self::return_expression(block) {
183-
return Self::expression_returns_unmodified_err(cx, return_expression, origin_hir_id);
179+
return Self::expression_returns_unmodified_err(cx, return_expression, cond_expr);
184180
}
185181

186182
false
187183
},
188-
ExprKind::Ret(Some(expr)) | ExprKind::Call(expr, _) => {
189-
Self::expression_returns_unmodified_err(cx, expr, origin_hir_id)
190-
},
191-
ExprKind::Path(_) => path_to_local(expression) == path_to_local(origin_hir_id),
184+
ExprKind::Ret(Some(expr)) => Self::expression_returns_unmodified_err(cx, expr, cond_expr),
185+
ExprKind::Path(_) => path_to_local(expression) == path_to_local(cond_expr),
192186
_ => false,
193187
}
194188
}

0 commit comments

Comments
 (0)