Skip to content

mention lint group in default level lint note#140794

Merged
bors merged 2 commits intorust-lang:masterfrom
karolzwolak:allow-unused-doc-65464
Aug 20, 2025
Merged

mention lint group in default level lint note#140794
bors merged 2 commits intorust-lang:masterfrom
karolzwolak:allow-unused-doc-65464

Conversation

@karolzwolak
Copy link
Copy Markdown
Member

@karolzwolak karolzwolak commented May 8, 2025

Summary

This PR updates lint diagnostics so that default-level notes now mention the lint group they belong to, if any.
Fixes: #65464.

Example

fn main() {
    let x = 5;
}

Before:

= note: `#[warn(unused_variables)]` on by default

After:

= note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default

Unchanged Cases

Messages remain the same when the lint level is explicitly set, e.g.:

  • Attribute on the lint #[warn(unused_variables)]:

    note: the lint level is defined here
    LL | #[warn(unused_variables)]
       |        ^^^^^^^^^^^^^^^^
    
  • Attribute on the group #[warn(unused)]::

    = note: `#[warn(unused_variables)]` implied by `#[warn(unused)]`
    
  • CLI option -W unused:

    = note: `-W unused-variables` implied by `-W unused`
    = help: to override `-W unused` add `#[allow(unused_variables)]`
    
  • CLI option -W unused-variables:

    = note: requested on the command line with `-W unused-variables`
    

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make the documentation about #![allow(unused)] more visible