Skip to content

Commit 8dc8649

Browse files
committed
Add test or unused import removal suggestion with attributes.
1 parent f1860d1 commit 8dc8649

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// run-rustfix
2+
#![deny(unused_imports)]
3+
4+
// Check that attributes get removed too. See #87973.
5+
6+
//~^ ERROR unused import
7+
8+
fn main() {}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// run-rustfix
2+
#![deny(unused_imports)]
3+
4+
// Check that attributes get removed too. See #87973.
5+
#[deprecated]
6+
#[allow(unsafe_code)]
7+
#[cfg(not(foo))]
8+
use std::fs;
9+
//~^ ERROR unused import
10+
11+
fn main() {}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error: unused import: `std::fs`
2+
--> $DIR/unused-import-issue-87973.rs:8:5
3+
|
4+
LL | use std::fs;
5+
| ^^^^^^^
6+
|
7+
note: the lint level is defined here
8+
--> $DIR/unused-import-issue-87973.rs:2:9
9+
|
10+
LL | #![deny(unused_imports)]
11+
| ^^^^^^^^^^^^^^
12+
13+
error: aborting due to previous error
14+

0 commit comments

Comments
 (0)