refactor: remove need for MethodCall matching
This commit is contained in:
parent
4580c8a9b7
commit
765cce11b1
1 changed files with 1 additions and 8 deletions
|
@ -39,13 +39,6 @@ pub(super) fn check<'tcx>(
|
||||||
return;
|
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 mut applicability = Applicability::MachineApplicable;
|
||||||
let suggestion = format!(
|
let suggestion = format!(
|
||||||
"unwrap_or({})",
|
"unwrap_or({})",
|
||||||
|
@ -55,7 +48,7 @@ pub(super) fn check<'tcx>(
|
||||||
span_lint_and_sugg(
|
span_lint_and_sugg(
|
||||||
cx,
|
cx,
|
||||||
OR_THEN_UNWRAP,
|
OR_THEN_UNWRAP,
|
||||||
or_span.to(unwrap_span),
|
unwrap_expr.span.with_lo(or_span.lo()),
|
||||||
title,
|
title,
|
||||||
"try this",
|
"try this",
|
||||||
suggestion,
|
suggestion,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue