You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rollup merge of rust-lang#140794 - karolzwolak:allow-unused-doc-65464, r=davidtwco
Add information about group a lint belongs to
# Description
Fixes: rust-lang#65464
## Changes Made
- Extended the default lint settings message to include the lint group they belong to
- Modified the proposed fix message wording from "part of" to "implied by" for better accuracy
- Old message: `` `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default ``
- New message: `` `#[warn(unused_variables)]` (implied by `#[warn(unused)]`) on by default ``
## Rationale
1. The new wording ("implied by") better reflects the actual relationship between lint groups and their members
2. It maintains consistency with messages shown when manually setting lint levels
3. The change helps users understand the hierarchy of lint settings
## Implementation Notes
- Only affects messages for default lint levels (not shown when levels are overridden)
- External lints remain unchanged (potential discussion point for future changes)
## Examples
### Case 1: Unchanged behavior when lint level is overridden
```rust
#[deny(unused)]
fn main() {
let x = 5;
}
```
Result:
```
note: the lint level is defined here
--> src/main.rs:1:8
|
1 | #[deny(unused)]
| ^^^^^^
= note: `#[deny(unused_variables)]` implied by `#[deny(unused)]`
```
### Case 2: Changed behavior for default lint levels
```rust
fn main() {
let x = 5;
}
```
New output:
```
= note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default
```
Previous output:
```
= note: `#[warn(unused_variables)]` on by default
```
## Discussion Points
- Should we extend this change to external lints as well?
- Is "part of" the most accurate terminology?
- Doesn't this additional info bloat the message? Perhaps a clippy lint suggesting overriding a whole group instead of a few lints manually would be better
Copy file name to clipboardExpand all lines: src/tools/clippy/tests/ui/checked_unwrap/simple_conditionals.stderr
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -330,7 +330,7 @@ LL | if X.is_some() {
330
330
|
331
331
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/static-mut-references.html>
332
332
= note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives
333
-
= note: `#[deny(static_mut_refs)]` on by default
333
+
= note: `#[deny(static_mut_refs)]` (part of `#[deny(rust_2024_compatibility)]`) on by default
0 commit comments