From 352da1d33dd3f568c2c7bf6887879e3b569209bb Mon Sep 17 00:00:00 2001 From: flip1995 <9744647+flip1995@users.noreply.github.com> Date: Tue, 18 Sep 2018 11:36:59 +0200 Subject: [PATCH] Add test for non-crate-level inner attributes --- tests/ui/cfg_attr_lint.rs | 10 +++++++++- tests/ui/cfg_attr_lint.stderr | 8 +++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/tests/ui/cfg_attr_lint.rs b/tests/ui/cfg_attr_lint.rs index d543db06d6c..1005af8b9ea 100644 --- a/tests/ui/cfg_attr_lint.rs +++ b/tests/ui/cfg_attr_lint.rs @@ -6,4 +6,12 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #[cfg_attr(rustfmt, rustfmt_skip)] -fn main() {} +fn main() { + foo::f(); +} + +mod foo { + #![cfg_attr(rustfmt, rustfmt_skip)] + + pub fn f() {} +} diff --git a/tests/ui/cfg_attr_lint.stderr b/tests/ui/cfg_attr_lint.stderr index 3a515f155c1..b166d4028d9 100644 --- a/tests/ui/cfg_attr_lint.stderr +++ b/tests/ui/cfg_attr_lint.stderr @@ -6,5 +6,11 @@ error: `cfg_attr` is deprecated for rustfmt and got replaced by tool_attributes | = note: `-D clippy::deprecated-cfg-attr` implied by `-D warnings` -error: aborting due to previous error +error: `cfg_attr` is deprecated for rustfmt and got replaced by tool_attributes + --> $DIR/cfg_attr_lint.rs:14:5 + | +14 | #![cfg_attr(rustfmt, rustfmt_skip)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `#![rustfmt::skip]` + +error: aborting due to 2 previous errors