Skip to content
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

Always show the lint name involved in a diagnostic? #134634

Open
Kannen opened this issue Dec 11, 2024 · 3 comments
Open

Always show the lint name involved in a diagnostic? #134634

Kannen opened this issue Dec 11, 2024 · 3 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. C-discussion Category: Discussion or questions that doesn't represent real issues. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-diagnostics Working group: Diagnostics

Comments

@Kannen
Copy link

Kannen commented Dec 11, 2024

Description

After the first occurrence of a lint, the name of the lint is not displayed anymore.

That is a real annoyance:

  • When the diagnostics are shown in a console, one has to find out the first occurrence of the error.
  • When the diagnostics are shown in an IDE, there is not such a thing as the first diagnostics so it is almost impossible to find out the name of the lint.

I do not see any good reason to optimize one line of such a useful information. (Or maybe there are still hobbyist using teleprinter and Altair 8800???).

Version


Additional Labels

No response

@y21 y21 transferred this issue from rust-lang/rust-clippy Dec 21, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Dec 21, 2024
@y21
Copy link
Member

y21 commented Dec 21, 2024

For reference, this was an intentional decision made in #42919, but in any case, I'm moving this to the rust repo as the behavior of this note is inherited from/implemented in the compiler (and presumably you don't just want this for clippy lints specifically but also for e.g. rustc's dead_code lint warnings?), so not really actionable from the clippy side.

@y21 y21 added the A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. label Dec 21, 2024
@jieyouxu jieyouxu added C-discussion Category: Discussion or questions that doesn't represent real issues. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-diagnostics Area: Messages for errors, warnings, and lints WG-diagnostics Working group: Diagnostics and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Dec 24, 2024
@jieyouxu jieyouxu changed the title Clippy shall always show the lint name involved in a diagnostic Always show the lint name involved in a diagnostic? Dec 24, 2024
@clubby789
Copy link
Contributor

Image
Regarding the second point, at least with my VS Code + Rust-Analyzer config, the name of the lint is displayed inline on the first occurrence, and always displayed in the popup when mousing over the yellow squiggly

Regarding the request in general, I feel that the output when there's several lints is already quite busy and appreciate any reductions. I'd assume the lint name is generally exclusively needed when #[allow]ing - which IMO should be the less common case, as resolving them would generally be preferred; I think it's okay if a little more work is needed to identify the name

@jieyouxu
Copy link
Member

This was intentional as discussed in #38103 (comment) and implemented in #42919, as it can become quite verbose if we repeat the lint name for each lint-related diagnostics.

Possibly, I could see maybe something like a compiler flag that requests all (main) lint diagnostics not omit lint names in follow-up diagnostics, but I don't think we'll want to do that as a default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. C-discussion Category: Discussion or questions that doesn't represent real issues. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-diagnostics Working group: Diagnostics
Projects
None yet
Development

No branches or pull requests

5 participants