diff --git a/clippy_lints/src/implicit_return.rs b/clippy_lints/src/implicit_return.rs index 4df9789f3..ceda65781 100644 --- a/clippy_lints/src/implicit_return.rs +++ b/clippy_lints/src/implicit_return.rs @@ -46,8 +46,8 @@ static LINT_BREAK: &str = "change `break` to `return` as shown"; static LINT_RETURN: &str = "add `return` as shown"; fn lint(cx: &LateContext<'_, '_>, outer_span: Span, inner_span: Span, msg: &str) { - let outer_span = span_to_outer_expn(outer_span); - let inner_span = span_to_outer_expn(inner_span); + let outer_span = outer_span.source_callsite(); + let inner_span = inner_span.source_callsite(); span_lint_and_then(cx, IMPLICIT_RETURN, outer_span, "missing return statement", |db| { if let Some(snippet) = snippet_opt(cx, inner_span) { @@ -61,14 +61,6 @@ fn lint(cx: &LateContext<'_, '_>, outer_span: Span, inner_span: Span, msg: &str) }); } -fn span_to_outer_expn(span: Span) -> Span { - if let Some(expr) = span.ctxt().outer_expn_info() { - span_to_outer_expn(expr.call_site) - } else { - span - } -} - fn expr_match(cx: &LateContext<'_, '_>, expr: &Expr) { match &expr.node { // loops could be using `break` instead of `return`