Skip to content

Commit

Permalink
refactor: remove need for MethodCall matching
Browse files Browse the repository at this point in the history
  • Loading branch information
FoseFx committed Mar 20, 2022
1 parent 4580c8a commit 765cce1
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions clippy_lints/src/methods/or_then_unwrap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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({})",
Expand All @@ -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,
Expand Down

0 comments on commit 765cce1

Please sign in to comment.