Add test or unused import removal suggestion with attributes.

This commit is contained in:
Mara Bos 2021-08-12 17:35:57 +02:00
parent f1860d1901
commit 8dc8649bd7
3 changed files with 33 additions and 0 deletions

View file

@ -0,0 +1,8 @@
// run-rustfix
#![deny(unused_imports)]
// Check that attributes get removed too. See #87973.
//~^ ERROR unused import
fn main() {}

View file

@ -0,0 +1,11 @@
// run-rustfix
#![deny(unused_imports)]
// Check that attributes get removed too. See #87973.
#[deprecated]
#[allow(unsafe_code)]
#[cfg(not(foo))]
use std::fs;
//~^ ERROR unused import
fn main() {}

View file

@ -0,0 +1,14 @@
error: unused import: `std::fs`
--> $DIR/unused-import-issue-87973.rs:8:5
|
LL | use std::fs;
| ^^^^^^^
|
note: the lint level is defined here
--> $DIR/unused-import-issue-87973.rs:2:9
|
LL | #![deny(unused_imports)]
| ^^^^^^^^^^^^^^
error: aborting due to previous error