Merge pull request #1827 from erickt/master

`in_macro` check in `NEEDLESS_RETURN`
This commit is contained in:
llogiq 2017-06-13 06:53:17 +02:00 committed by GitHub
commit 92fac4ac1a

View File

@ -3,7 +3,8 @@ use syntax::ast;
use syntax::codemap::{Span, Spanned}; use syntax::codemap::{Span, Spanned};
use syntax::visit::FnKind; use syntax::visit::FnKind;
use utils::{span_note_and_lint, span_lint_and_then, snippet_opt, match_path_ast, in_external_macro}; use utils::{span_note_and_lint, span_lint_and_then, snippet_opt, match_path_ast, in_macro,
in_external_macro};
/// **What it does:** Checks for return statements at the end of a block. /// **What it does:** Checks for return statements at the end of a block.
/// ///
@ -89,7 +90,7 @@ impl ReturnPass {
} }
fn emit_return_lint(&mut self, cx: &EarlyContext, ret_span: Span, inner_span: Span) { fn emit_return_lint(&mut self, cx: &EarlyContext, ret_span: Span, inner_span: Span) {
if in_external_macro(cx, inner_span) { if in_external_macro(cx, inner_span) || in_macro(inner_span) {
return; return;
} }
span_lint_and_then(cx, span_lint_and_then(cx,