Auto merge of #5250 - mlegner:unused_fp, r=flip1995
Whitelist unused attribute for use items. This PR whitelists the `unused` attribute with `use` items and adds a corresponding test case. Fixes: #5229 changelog: none
This commit is contained in:
commit
5d3e3e1a9e
@ -248,6 +248,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Attributes {
|
||||
if is_word(lint, sym!(unused_imports))
|
||||
|| is_word(lint, sym!(deprecated))
|
||||
|| is_word(lint, sym!(unreachable_pub))
|
||||
|| is_word(lint, sym!(unused))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -20,6 +20,10 @@ extern crate proc_macro_derive;
|
||||
#[allow(unused_imports)]
|
||||
use std::collections;
|
||||
|
||||
// don't lint on unused for `use` items
|
||||
#[allow(unused)]
|
||||
use std::option;
|
||||
|
||||
// don't lint on deprecated for `use` items
|
||||
mod foo {
|
||||
#[deprecated]
|
||||
|
@ -20,6 +20,10 @@ extern crate proc_macro_derive;
|
||||
#[allow(unused_imports)]
|
||||
use std::collections;
|
||||
|
||||
// don't lint on unused for `use` items
|
||||
#[allow(unused)]
|
||||
use std::option;
|
||||
|
||||
// don't lint on deprecated for `use` items
|
||||
mod foo {
|
||||
#[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)`
|
||||
|
||||
error: useless lint attribute
|
||||
--> $DIR/useless_attribute.rs:49:5
|
||||
--> $DIR/useless_attribute.rs:53:5
|
||||
|
|
||||
LL | #[allow(clippy::almost_swapped)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: if you just forgot a `!`, use: `#![allow(clippy::almost_swapped)]`
|
||||
|
Loading…
x
Reference in New Issue
Block a user