From 44c835feead3bbc0c993a7ee20a51cb9ce1e07d9 Mon Sep 17 00:00:00 2001 From: Unknown Date: Sat, 19 Jan 2019 17:35:32 -0500 Subject: [PATCH] Skipping check if in external macro. --- clippy_lints/src/functions.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/clippy_lints/src/functions.rs b/clippy_lints/src/functions.rs index e95bf6639fc8..0da7e26a1be4 100644 --- a/clippy_lints/src/functions.rs +++ b/clippy_lints/src/functions.rs @@ -3,7 +3,7 @@ use matches::matches; use rustc::hir; use rustc::hir::def::Def; use rustc::hir::intravisit; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use rustc::lint::{in_external_macro, LateContext, LateLintPass, LintArray, LintContext, LintPass}; use rustc::ty; use rustc::{declare_tool_lint, lint_array}; use rustc_data_structures::fx::FxHashSet; @@ -179,6 +179,10 @@ impl<'a, 'tcx> Functions { } fn check_line_number(self, cx: &LateContext<'_, '_>, span: Span) { + if in_external_macro(cx.sess(), span) { + return; + } + let code_snippet = snippet(cx, span, ".."); let mut line_count: u64 = 0; let mut in_comment = false;