diff options
| author | hyd-dev <yd-huang@outlook.com> | 2021-04-11 01:08:31 +0800 |
|---|---|---|
| committer | hyd-dev <yd-huang@outlook.com> | 2021-04-17 18:11:07 +0800 |
| commit | ac044e35aa4ce72569d59ab46b560eb37b930f52 (patch) | |
| tree | eaad93faaf2abc866b06e28bd3be3bcedec07ecf /src | |
| parent | e43c2005f250b51e24d294da0b228e0a2dc4d9b2 (diff) | |
| download | rust-ac044e35aa4ce72569d59ab46b560eb37b930f52.tar.gz rust-ac044e35aa4ce72569d59ab46b560eb37b930f52.zip | |
Do not ignore path segments in the middle in `#[allow]`/`#[warn]`/`#[deny]`/`#[forbid]` attributes
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/lint/issue-83477.rs | 16 | ||||
| -rw-r--r-- | src/test/ui/lint/issue-83477.stderr | 30 | ||||
| -rw-r--r-- | src/tools/clippy/tests/ui/filter_methods.rs | 2 |
3 files changed, 47 insertions, 1 deletions
diff --git a/src/test/ui/lint/issue-83477.rs b/src/test/ui/lint/issue-83477.rs new file mode 100644 index 00000000000..0eba52acfa3 --- /dev/null +++ b/src/test/ui/lint/issue-83477.rs @@ -0,0 +1,16 @@ +// check-pass +#![warn(rustc::internal)] + +#[allow(rustc::foo::bar::default_hash_types)] +//~^ WARN unknown lint: `rustc::foo::bar::default_hash_types` +//~| HELP did you mean +//~| SUGGESTION rustc::default_hash_types +#[allow(rustc::foo::default_hash_types)] +//~^ WARN unknown lint: `rustc::foo::default_hash_types` +//~| HELP did you mean +//~| SUGGESTION rustc::default_hash_types +fn main() { + let _ = std::collections::HashMap::<String, String>::new(); + //~^ WARN Prefer FxHashMap over HashMap, it has better performance + //~| HELP use +} diff --git a/src/test/ui/lint/issue-83477.stderr b/src/test/ui/lint/issue-83477.stderr new file mode 100644 index 00000000000..dbe0c9e0130 --- /dev/null +++ b/src/test/ui/lint/issue-83477.stderr @@ -0,0 +1,30 @@ +warning: unknown lint: `rustc::foo::bar::default_hash_types` + --> $DIR/issue-83477.rs:4:9 + | +LL | #[allow(rustc::foo::bar::default_hash_types)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: did you mean: `rustc::default_hash_types` + | + = note: `#[warn(unknown_lints)]` on by default + +warning: unknown lint: `rustc::foo::default_hash_types` + --> $DIR/issue-83477.rs:8:9 + | +LL | #[allow(rustc::foo::default_hash_types)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: did you mean: `rustc::default_hash_types` + +warning: Prefer FxHashMap over HashMap, it has better performance + --> $DIR/issue-83477.rs:13:31 + | +LL | let _ = std::collections::HashMap::<String, String>::new(); + | ^^^^^^^ help: use: `FxHashMap` + | +note: the lint level is defined here + --> $DIR/issue-83477.rs:2:9 + | +LL | #![warn(rustc::internal)] + | ^^^^^^^^^^^^^^^ + = note: `#[warn(rustc::default_hash_types)]` implied by `#[warn(rustc::internal)]` + = note: a `use rustc_data_structures::fx::FxHashMap` may be necessary + +warning: 3 warnings emitted + diff --git a/src/tools/clippy/tests/ui/filter_methods.rs b/src/tools/clippy/tests/ui/filter_methods.rs index 51450241619..96121b114ce 100644 --- a/src/tools/clippy/tests/ui/filter_methods.rs +++ b/src/tools/clippy/tests/ui/filter_methods.rs @@ -1,5 +1,5 @@ #![warn(clippy::all, clippy::pedantic)] -#![allow(clippy::clippy::let_underscore_drop)] +#![allow(clippy::let_underscore_drop)] #![allow(clippy::missing_docs_in_private_items)] fn main() { |
