Skip to content

Lint errors resulting from lint groups or "warnings" meta-lint obscure the original lint name #36846

Closed
@brson

Description

@brson

This has frustrated me several times. Lint errors are at their best when they tell you which lint triggered them. Example

fn main() { }
fn foo() { }
warning: function is never used: `foo`, #[warn(dead_code)] on by default
 --> main.rs:2:1
  |
2 | fn foo() { }
  | ^^^^^^^^^^^^

So now I know that if the lint is wrong I can write allow(dead_code). On the other hand:

#![deny(warnings)]
fn main() { }
fn foo() { }
error: function is never used: `foo`
 --> main.rs:3:1
  |
3 | fn foo() { }
  | ^^^^^^^^^^^^
  |
note: lint level defined here
 --> main.rs:1:9
  |
1 | #![deny(warnings)]
  |         ^^^^^^^^

error: aborting due to previous error

Now I have no idea what to write to shut the compiler up. Likewise:

#![deny(unused)]
fn main() { }
fn foo() { }

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions