Skip to content

Commit 765cce1

Browse files
committed
refactor: remove need for MethodCall matching
1 parent 4580c8a commit 765cce1

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

clippy_lints/src/methods/or_then_unwrap.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,6 @@ pub(super) fn check<'tcx>(
3939
return;
4040
}
4141

42-
let unwrap_span = if let ExprKind::MethodCall(_, _, span) = unwrap_expr.kind {
43-
span
44-
} else {
45-
// unreachable. but fallback to ident's span ("()" are missing)
46-
unwrap_expr.span
47-
};
48-
4942
let mut applicability = Applicability::MachineApplicable;
5043
let suggestion = format!(
5144
"unwrap_or({})",
@@ -55,7 +48,7 @@ pub(super) fn check<'tcx>(
5548
span_lint_and_sugg(
5649
cx,
5750
OR_THEN_UNWRAP,
58-
or_span.to(unwrap_span),
51+
unwrap_expr.span.with_lo(or_span.lo()),
5952
title,
6053
"try this",
6154
suggestion,

0 commit comments

Comments
 (0)