Skip to content

Commit 44c835f

Browse files
Unknownunknown
authored andcommitted
Skipping check if in external macro.
1 parent 0245620 commit 44c835f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

clippy_lints/src/functions.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use matches::matches;
33
use rustc::hir;
44
use rustc::hir::def::Def;
55
use rustc::hir::intravisit;
6-
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
6+
use rustc::lint::{in_external_macro, LateContext, LateLintPass, LintArray, LintContext, LintPass};
77
use rustc::ty;
88
use rustc::{declare_tool_lint, lint_array};
99
use rustc_data_structures::fx::FxHashSet;
@@ -179,6 +179,10 @@ impl<'a, 'tcx> Functions {
179179
}
180180

181181
fn check_line_number(self, cx: &LateContext<'_, '_>, span: Span) {
182+
if in_external_macro(cx.sess(), span) {
183+
return;
184+
}
185+
182186
let code_snippet = snippet(cx, span, "..");
183187
let mut line_count: u64 = 0;
184188
let mut in_comment = false;

0 commit comments

Comments
 (0)