Clean up unused rendering code in ruff_linter#19832
Merged
Conversation
Contributor
|
ruff_linter
Contributor
Diagnostic diff on typing conformance testsNo changes detected when running ty on typing conformance tests ✅ |
Contributor
|
dcreager
added a commit
that referenced
this pull request
Aug 11, 2025
* main: (31 commits) Add AIR301 rule (#17707) Avoid underflow in default ranges before a BOM (#19839) Update actions/download-artifact digest to de96f46 (#19852) Update docker/login-action action to v3.5.0 (#19860) Update rui314/setup-mold digest to 7344740 (#19853) Update cargo-bins/cargo-binstall action to v1.14.4 (#19855) Update actions/cache action to v4.2.4 (#19854) Update Rust crate hashbrown to v0.15.5 (#19858) Update Rust crate camino to v1.1.11 (#19857) Update Rust crate proc-macro2 to v1.0.96 (#19859) Update dependency ruff to v0.12.8 (#19856) SIM905: Fix handling of U+001C..U+001F whitespace (#19849) RUF064: offer a safe fix for multi-digit zeros (#19847) Clean up unused rendering code in `ruff_linter` (#19832) [ty] Add Salsa caching to `TupleType::to_class_type` (#19840) [ty] Handle cycles when finding implicit attributes (#19833) [ty] fix goto-definition on imports (#19834) [ty] Implement stdlib stub mapping (#19529) [`flake8-comprehensions`] Fix false positive for `C420` with attribute, subscript, or slice assignment targets (#19513) [ty] Implement module-level `__getattr__` support (#19791) ...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This is a follow-up to #19415 (comment) to remove some unused code. As Micha noticed,
GroupedEmitter::with_show_sourcewas only used in local unit tests1 and was safe to remove. This allowed deletingMessageCodeFrameand a lot more helper code previously shared with thefulloutput format.I also moved some other code from
text.rsandmessage/mod.rsintogrouped.rsthat is now only used for thegroupedformat. With a little refactoring of theconciserendering logic inruff_db, we could probably removeRuleCodeAndBodytoo. The only difference I see from theconciseoutput is whether we print the filename next to the row and column or not:But I didn't try to do that here.
Test Plan
Existing tests, with the source code no longer displayed. I also deleted one test, as it was now a duplicate of the
defaulttest.Footnotes
"Local unit tests" as opposed to all of our linter snapshot tests, as is the case for
TextEmitter::with_show_fix_diff. We also want to expose that to users eventually (https://github.com/astral-sh/ruff/issues/7352), which I don't believe is the case for thegroupedformat. ↩