Skip to content

Conversation

som-snytt
Copy link
Contributor

@som-snytt som-snytt commented Sep 23, 2025

Fixes #24009

Why was the ticket worth tackling?

-Wconf allows users to control which optional warnings are reported, which is convenient for limiting noise and essential under -Werror. However, unwanted lints are destructive under -rewrite.

How I fixed it

Instead of gating at the lint (for unused imports), enhance the reporter to apply code actions for lint warnings.

Why is this PR worth reviewing?

This PR turns out to be more complex in UX than in code.

What's the worse that could happen?

The code action in CheckUnused is always emitted when the lint is enabled. That could be noisy in an interactive environment that displays quickfixes.

@som-snytt som-snytt force-pushed the issue/24009-rewrite-import-wconf branch from 5706106 to 8c198cf Compare September 26, 2025 22:04
@som-snytt som-snytt force-pushed the issue/24009-rewrite-import-wconf branch from 8c198cf to a7a8f7a Compare October 4, 2025 00:33
Partially duplicates reporter logic; reporter could auto-apply
actions, maybe keying off diagnostic ID.
Instead of testing whether to emit actions by probing suppressions,
just let the reporter apply LintWarning actions when the warning
is actually reported.
@som-snytt som-snytt force-pushed the issue/24009-rewrite-import-wconf branch from a7a8f7a to 82fe265 Compare October 15, 2025 15:04
@som-snytt
Copy link
Contributor Author

I tried to strike a better balance in verbosity in the PR comment.

@som-snytt som-snytt marked this pull request as ready for review October 15, 2025 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Import rewrite should respect -Wconf (rewrite when warning)

1 participant