Skip to content

Commit 8cde275

Browse files
blyxyasflip1995
authored andcommitted
Ignore in-proc-macros items
1 parent cbadffc commit 8cde275

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/tools/clippy/clippy_lints/src/items_after_test_module.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use clippy_utils::{diagnostics::span_lint_and_help, is_in_cfg_test};
1+
use clippy_utils::{diagnostics::span_lint_and_help, is_from_proc_macro, is_in_cfg_test};
22
use rustc_hir::{HirId, ItemId, ItemKind, Mod};
33
use rustc_lint::{LateContext, LateLintPass, LintContext};
44
use rustc_middle::lint::in_external_macro;
@@ -59,6 +59,7 @@ impl LateLintPass<'_> for ItemsAfterTestModule {
5959
if !matches!(item.kind, ItemKind::Mod(_));
6060
if !is_in_cfg_test(cx.tcx, itid.hir_id()); // The item isn't in the testing module itself
6161
if !in_external_macro(cx.sess(), item.span);
62+
if !is_from_proc_macro(cx, item);
6263

6364
then {
6465
span_lint_and_help(cx, ITEMS_AFTER_TEST_MODULE, test_mod_span.unwrap().with_hi(item.span.hi()), "items were found after the testing module", None, "move the items to before the testing module was defined");

0 commit comments

Comments
 (0)