-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unused import lint can be less noisy #16132
Comments
Example: #![crate_type = "lib"]
use foo::{Foo, Bar, Baz, Qux};
mod foo {
pub struct Foo;
pub struct Bar;
pub struct Baz;
pub struct Qux;
} Output:
Desired output:
|
I had a look at this issue and was wondering whether multiple spans in one line are supported at the moment? I traced the code for the printing the spans to libsyntax/diagnostic.rs. I guess a patch for this issue will require some digging there? |
Multiple spans on one line are not supported, that would need to be added On Mon, Aug 4, 2014 at 3:26 PM, Florian Hahn notifications@github.com
|
Now that there are MultiSpans (thanks to @mitaa), I'd like to look into this. |
Should this be closed? |
Looks like OPs example still creates the same spew. A lot has changed in rustc diagnostics so @fhahn's unmerged patch is probably unsalvageable. @jonathandturner what's the correct approach for a newbie to tackle this? |
…turner Group unused import warnings per import list Given a file ``` rust use std::collections::{BinaryHeap, BTreeMap, BTreeSet}; fn main() {} ``` Show a single warning, instead of three for each unused import: ``` nocode warning: unused imports, #[warn(unused_imports)] on by default --> file2.rs:1:24 | 1 | use std::collections::{BinaryHeap, BTreeMap, BTreeSet}; | ^^^^^^^^^^ ^^^^^^^^ ^^^^^^^^ ``` Include support for lints pointing at `MultilineSpan`s, instead of just `Span`s. Fixes #16132.
Example:
These are all on the same line. When visiting imports inside of an import list, it should underline each name individually, but in the same error message, with the other unused names in the import list, if any.
The text was updated successfully, but these errors were encountered: