Skip to content

Commit 31efc10

Browse files
J-ZhengLisamueltardieuCentri3
authored
Apply suggestions from code review
Co-authored-by: Samuel Tardieu <[email protected]> Co-authored-by: Catherine Flores <[email protected]>
1 parent 22ba792 commit 31efc10

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

clippy_lints/src/option_if_let_else.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,9 @@ fn try_get_option_occurrence<'tcx>(
166166

167167
let mut app = Applicability::Unspecified;
168168

169-
let (none_body, is_argless_call) = if let Some(call_expr) = try_get_argless_call_expr(none_body) {
170-
(call_expr, true)
171-
} else {
172-
(none_body, false)
169+
let (none_body, is_argless_call) = match none_body.kind {
170+
ExprKind::Call(call_expr, []) if !none_body.span.from_expansion() => (call_expr, true),
171+
_ => (none_body, false),
173172
};
174173

175174
return Some(OptionOccurrence {
@@ -195,7 +194,7 @@ fn try_get_option_occurrence<'tcx>(
195194
None
196195
}
197196

198-
/// Gets the call expr iff it does not have any args and was not from macro expansion.
197+
/// Gets the call expr if it does not have any args and was not from macro expansion.
199198
fn try_get_argless_call_expr<'tcx>(expr: &Expr<'tcx>) -> Option<&'tcx Expr<'tcx>> {
200199
match expr.kind {
201200
ExprKind::Call(call_expr, []) if !expr.span.from_expansion() => Some(call_expr),

0 commit comments

Comments
 (0)