-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Closed
Description
rustc correctly highlights unused imports, but doesn't provide an action to remove them. Providing the removal via the lint allows fix buttons in IDEs to handle unused imports and further more automatic behaviour working towards rust-lang/rls#742.
Can unused import suggested removal be added?
use std::{f64, u64, u8 as Foo};
pub fn main() {
let _s = u64::MAX;
}warning: unused imports: `f64`, `u8 as Foo`
--> src/main.rs:4:11
|
4 | use std::{f64, u64, u8 as Foo};
| ^^^ ^^^^^^^^^
|
= note: #[warn(unused_imports)] on by default
{
"children": [{
"children": [],
"code": null,
"level": "note",
"message": "#[warn(unused_imports)] on by default",
"rendered": null,
"spans": []
}],
"code": {
"code": "unused_imports",
"explanation": null
},
"level": "warning",
"message": "unused imports: `f64`, `u8 as Foo`",
"rendered": "warning: unused imports: `f64`, `u8 as Foo`\n --> src/main.rs:4:11\n |\n4 | use std::{f64, u64, u8 as Foo};\n | ^^^ ^^^^^^^^^\n |\n = note: #[warn(unused_imports)] on by default\n\n",
"spans": [{
"byte_end": 56,
"byte_start": 53,
"column_end": 14,
"column_start": 11,
"expansion": null,
"file_name": "src/main.rs",
"is_primary": true,
"label": null,
"line_end": 4,
"line_start": 4,
"suggested_replacement": null,
"text": [{
"highlight_end": 14,
"highlight_start": 11,
"text": "use std::{f64, u64, u8 as Foo};"
}]
}, {
"byte_end": 72,
"byte_start": 63,
"column_end": 30,
"column_start": 21,
"expansion": null,
"file_name": "src/main.rs",
"is_primary": true,
"label": null,
"line_end": 4,
"line_start": 4,
"suggested_replacement": null,
"text": [{
"highlight_end": 30,
"highlight_start": 21,
"text": "use std::{f64, u64, u8 as Foo};"
}]
}]
}Metadata
Metadata
Assignees
Labels
No labels