Add test or unused import removal suggestion with attributes.
This commit is contained in:
parent
f1860d1901
commit
8dc8649bd7
3 changed files with 33 additions and 0 deletions
8
src/test/ui/imports/unused-import-issue-87973.fixed
Normal file
8
src/test/ui/imports/unused-import-issue-87973.fixed
Normal file
|
@ -0,0 +1,8 @@
|
|||
// run-rustfix
|
||||
#![deny(unused_imports)]
|
||||
|
||||
// Check that attributes get removed too. See #87973.
|
||||
|
||||
//~^ ERROR unused import
|
||||
|
||||
fn main() {}
|
11
src/test/ui/imports/unused-import-issue-87973.rs
Normal file
11
src/test/ui/imports/unused-import-issue-87973.rs
Normal 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() {}
|
14
src/test/ui/imports/unused-import-issue-87973.stderr
Normal file
14
src/test/ui/imports/unused-import-issue-87973.stderr
Normal 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
|
||||
|
Loading…
Add table
Reference in a new issue