about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMax Baumann <max@bmn.dev>2022-03-21 00:04:37 +0100
committerMax Baumann <max@bmn.dev>2022-03-21 00:04:37 +0100
commit765cce11b10eabe667b42df1a9a878fe38b713ce (patch)
treee17f45ad4a458917ef5fa466fb7469137fcbf58a
parent4580c8a9b7f61d2e9968ae1aaab08cfa2a5eb221 (diff)
downloadrust-765cce11b10eabe667b42df1a9a878fe38b713ce.tar.gz
rust-765cce11b10eabe667b42df1a9a878fe38b713ce.zip
refactor: remove need for MethodCall matching
-rw-r--r--clippy_lints/src/methods/or_then_unwrap.rs9
1 files changed, 1 insertions, 8 deletions
diff --git a/clippy_lints/src/methods/or_then_unwrap.rs b/clippy_lints/src/methods/or_then_unwrap.rs
index 28b1bfe8fb5..be5768c3545 100644
--- a/clippy_lints/src/methods/or_then_unwrap.rs
+++ b/clippy_lints/src/methods/or_then_unwrap.rs
@@ -39,13 +39,6 @@ pub(super) fn check<'tcx>(
         return;
     }
 
-    let unwrap_span = if let ExprKind::MethodCall(_, _, span) = unwrap_expr.kind {
-        span
-    } else {
-        // unreachable. but fallback to ident's span ("()" are missing)
-        unwrap_expr.span
-    };
-
     let mut applicability = Applicability::MachineApplicable;
     let suggestion = format!(
         "unwrap_or({})",
@@ -55,7 +48,7 @@ pub(super) fn check<'tcx>(
     span_lint_and_sugg(
         cx,
         OR_THEN_UNWRAP,
-        or_span.to(unwrap_span),
+        unwrap_expr.span.with_lo(or_span.lo()),
         title,
         "try this",
         suggestion,