mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 07:00:55 +00:00
Whitelist unused attribute for use items.
This commit is contained in:
parent
0f4a3feccc
commit
8669be56c4
4 changed files with 10 additions and 1 deletions
|
@ -248,6 +248,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Attributes {
|
||||||
if is_word(lint, sym!(unused_imports))
|
if is_word(lint, sym!(unused_imports))
|
||||||
|| is_word(lint, sym!(deprecated))
|
|| is_word(lint, sym!(deprecated))
|
||||||
|| is_word(lint, sym!(unreachable_pub))
|
|| is_word(lint, sym!(unreachable_pub))
|
||||||
|
|| is_word(lint, sym!(unused))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,10 @@ extern crate proc_macro_derive;
|
||||||
#[allow(unused_imports)]
|
#[allow(unused_imports)]
|
||||||
use std::collections;
|
use std::collections;
|
||||||
|
|
||||||
|
// don't lint on unused for `use` items
|
||||||
|
#[allow(unused)]
|
||||||
|
use std::option;
|
||||||
|
|
||||||
// don't lint on deprecated for `use` items
|
// don't lint on deprecated for `use` items
|
||||||
mod foo {
|
mod foo {
|
||||||
#[deprecated]
|
#[deprecated]
|
||||||
|
|
|
@ -20,6 +20,10 @@ extern crate proc_macro_derive;
|
||||||
#[allow(unused_imports)]
|
#[allow(unused_imports)]
|
||||||
use std::collections;
|
use std::collections;
|
||||||
|
|
||||||
|
// don't lint on unused for `use` items
|
||||||
|
#[allow(unused)]
|
||||||
|
use std::option;
|
||||||
|
|
||||||
// don't lint on deprecated for `use` items
|
// don't lint on deprecated for `use` items
|
||||||
mod foo {
|
mod foo {
|
||||||
#[deprecated]
|
#[deprecated]
|
||||||
|
|
|
@ -13,7 +13,7 @@ LL | #[cfg_attr(feature = "cargo-clippy", allow(dead_code))]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: if you just forgot a `!`, use: `#![cfg_attr(feature = "cargo-clippy", allow(dead_code)`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: if you just forgot a `!`, use: `#![cfg_attr(feature = "cargo-clippy", allow(dead_code)`
|
||||||
|
|
||||||
error: useless lint attribute
|
error: useless lint attribute
|
||||||
--> $DIR/useless_attribute.rs:49:5
|
--> $DIR/useless_attribute.rs:53:5
|
||||||
|
|
|
|
||||||
LL | #[allow(clippy::almost_swapped)]
|
LL | #[allow(clippy::almost_swapped)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: if you just forgot a `!`, use: `#![allow(clippy::almost_swapped)]`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: if you just forgot a `!`, use: `#![allow(clippy::almost_swapped)]`
|
||||||
|
|
Loading…
Reference in a new issue