rust/compiler/rustc_lint/src
Jacob Pratt 1e6df58e77
Rollup merge of #140794 - karolzwolak:allow-unused-doc-65464, r=davidtwco
mention lint group in default level lint note

### Summary

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

### Example

```rust
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`
  ```
2025-08-20 00:45:53 -04:00
..
early Rollup merge of #145274 - compiler-errors:unused-must-use, r=fmease 2025-08-13 07:03:49 +02:00
nonstandard_style mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
types Rollup merge of #144726 - jdonszelmann:move-attr-data-structures, r=lcnr 2025-07-31 17:19:40 +02:00
async_closures.rs Move some Map methods onto TyCtxt. 2025-02-17 13:21:02 +11:00
async_fn_in_trait.rs nightly feature tracking: get rid of the per-feature bool fields 2024-10-23 09:14:41 +01:00
autorefs.rs setup CI and tidy to use typos for spellchecking and fix few typos 2025-07-03 10:51:06 +03:00
builtin.rs Rollup merge of #145155 - scrabsha:push-tkvwkolzooyq, r=jdonszelmann 2025-08-12 20:37:51 +10:00
context.rs mention lint group in default level lint note 2025-08-19 21:27:10 +02:00
dangling.rs Add lint against dangling pointers form local variables 2025-07-31 22:35:22 +02:00
default_could_be_derived.rs Reduce indirect assoc parent queries 2025-08-08 17:28:19 -05:00
deref_into_dyn_supertrait.rs Propagate TraitImplHeader to hir 2025-08-11 17:05:42 -05:00
drop_forget_useless.rs Fix wrong spans with external macros in the dropping_copy_types lint 2025-08-15 11:59:23 +02:00
early.rs remove P 2025-08-09 15:47:01 +08:00
enum_intrinsics_non_enums.rs Fold visit into ty 2025-03-15 06:34:36 +00:00
errors.rs Move eager translation to a method on Diag 2025-04-16 21:38:59 -04:00
expect.rs Reduce uses of hir_crate. 2025-06-18 15:46:19 +00:00
for_loops_over_fallibles.rs Use span before macro expansion in lint for-loops-over-falibles 2025-05-08 21:17:33 +08:00
foreign_modules.rs Merge link_name and export_name 2025-08-15 10:04:04 +00:00
if_let_rescope.rs future-incompat lints: don't link to the nightly edition-guide version 2025-07-16 01:44:02 -07:00
impl_trait_overcaptures.rs future-incompat lints: don't link to the nightly edition-guide version 2025-07-16 01:44:02 -07:00
internal.rs Extend QueryStability to handle IntoIterator implementations 2025-08-15 12:10:54 -04:00
invalid_from_utf8.rs Introduce ByteSymbol. 2025-06-30 20:42:27 +10:00
late.rs Auto merge of #139597 - Kobzol:lint-skip, r=BoxyUwU 2025-07-26 02:31:12 +00:00
let_underscore.rs Rustfmt 2025-02-08 22:12:13 +00:00
levels.rs Make lints work with allow_internal_unstable 2025-07-23 00:10:58 +02:00
lib.rs Reword mismatched-lifetime-syntaxes text based on feedback 2025-07-14 09:52:58 -04:00
lifetime_syntax.rs Allow cargo fix to partially apply mismatched_lifetime_syntaxes 2025-07-28 20:03:05 +01:00
lints.rs Rollup merge of #145274 - compiler-errors:unused-must-use, r=fmease 2025-08-13 07:03:49 +02:00
macro_expr_fragment_specifier_2024_migration.rs future-incompat lints: don't link to the nightly edition-guide version 2025-07-16 01:44:02 -07:00
map_unit_fn.rs Refactor map_unit_fn lint 2025-08-08 15:01:01 -05:00
multiple_supertrait_upcastable.rs parse const trait Trait 2025-07-17 18:06:26 +08:00
non_ascii_idents.rs Make LevelAndSource a struct 2025-04-03 09:17:55 +00:00
non_fmt_panic.rs use let chains in hir, lint, mir 2025-07-28 06:10:14 +05:00
non_local_def.rs Rollup merge of #145153 - joshtriplett:macro-kinds-plural, r=petrochenkov 2025-08-13 18:43:01 +02:00
nonstandard_style.rs Extract ast TraitImplHeader 2025-08-11 17:05:36 -05:00
noop_method_call.rs Rename trait_of_item -> trait_of_assoc 2025-07-28 09:53:50 -05:00
opaque_hidden_inferred_bound.rs Squash fold into ty 2025-03-15 06:34:36 +00:00
pass_by_value.rs Cleanup assoc parent utils 2025-08-13 09:33:09 -05:00
passes.rs Auto merge of #139597 - Kobzol:lint-skip, r=BoxyUwU 2025-07-26 02:31:12 +00:00
precedence.rs Temporarily switch ambiguous_negative_literals lint to allow 2024-07-31 19:36:47 +02:00
ptr_nulls.rs fix: don't panic on volatile access to null 2025-07-18 13:41:34 -03:00
redundant_semicolon.rs Dont suggest remove semi inside macro expansion for redundant semi lint 2025-06-18 00:36:51 +08:00
reference_casting.rs setup CI and tidy to use typos for spellchecking and fix few typos 2025-07-03 10:51:06 +03:00
shadowed_into_iter.rs future-incompat lints: don't link to the nightly edition-guide version 2025-07-16 01:44:02 -07:00
static_mut_refs.rs future-incompat lints: don't link to the nightly edition-guide version 2025-07-16 01:44:02 -07:00
tests.rs update cfg(bootstrap) 2025-01-08 21:26:39 +01:00
traits.rs Rustfmt 2025-02-08 22:12:13 +00:00
transmute.rs Make UNNECESSARY_TRANSMUTES into a HIR lint 2025-05-25 15:57:48 +00:00
types.rs Cleanup assoc parent utils 2025-08-13 09:33:09 -05:00
unit_bindings.rs Rustfmt 2025-02-08 22:12:13 +00:00
unqualified_local_imports.rs Overhaul UsePath. 2025-06-03 08:23:21 +10:00
unused.rs remove rustc_attr_data_structures 2025-07-31 14:19:27 +02:00
utils.rs Uplift clippy::invalid_null_ptr_usage as invalid_null_arguments 2025-03-30 19:33:15 +02:00