Repository navigation
fix: stop advising -> for every arrow in a range - #192
Merged
Merged
Conversation
The arrow ranges told the writer to write `->` for each arrow that has no rule of its own. Most of those ranges mix directions, so the advice turned U+21A9 (leftwards) or U+21E7 (upwards) into a right arrow. A rule can now say that it has no replacement. The ranges of arrows say that, and the report names the character and tells the writer to choose an ASCII arrow that points the same way, or words for what it means. `fix` leaves these characters alone, with its own reason. The same characters are banned on the same lines, so findings do not change. The rules with one character, such as U+2192 and U+21D0, keep their replacements.
The report line for an arrow that only a range rule covers was about three times as long as the others. It now says: no one fits; write an ASCII arrow pointing the same way, or words. The doc comment on `lints.banned_chars` said every banned character has something plain to write instead. That is no longer true for these arrows, so it now says most do.
webern
force-pushed
the
m/deslag-arrows
branch
from
October 17, 2026 09:15
2bf9493 to
fffc012
Compare
The fix test over the corpus pins how many banned characters fix leaves for each reason. Two arrows that only a range rule covers (U+21C4 and U+21E7) moved from the reason for a range default to the new reason for an arrow with no replacement. The other counts, and the number fixed, are the same.
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
The
banned_charsarrow ranges (U+2190 to U+21FF, U+27F0 to U+27FF, U+2900 to U+297F, U+2798 to U+27AF, U+27B1 to U+27BE and U+2B00 to U+2B11) advised->for every arrow that has no rule of its own. Most of those ranges mix directions, so the advice reversed or garbled the meaning: a leftwards hook arrow, an upwards white arrow, a right-over-left pair and a north west arrow were all told "write->".Now an arrow that only a range covers gets no replacement. A rule's
insteadis anOption, andNonesays that no one thing fits. The report names the character and tells the writer to choose: an ASCII arrow that points the same way, or words for what it means.fixleaves these characters alone, with its own reason. This is the second option the issue offers. It matches the module doc, which already says that the default of a range rule is a guess at meaning that is left to the writer.One report line, before and after, for U+21A9:
Findings are unchanged: the same characters are banned on the same lines. Only the advice on a range arrow's line changes. The rules for one character, such as U+2192 (
->) and U+21D0 (<=), keep their replacements. Every existing.stderrand.jsonundertests/cases/andtests/golden/banned_chars.txtare byte-identical, since none of them holds an arrow that only a range covers.The issue's example of U+21D0 was stale: it has had its own rule since the issue was filed.
Not done: naming the direction of each arrow from its Unicode name. It needs a name table (a dependency, or about 300 entries written by hand that CI cannot check), and it would still need this fallback for arrows that no ASCII arrow writes, such as circles, zigzags and harpoons. It can come later on top of this. No changelog entry: this fixes wrong advice and adds no lint, setting, feature or migration.
Testing
make ci-fast: exit 0tests/chars.rs: no arrow range rule names a replacement; U+21A9, U+21E7, U+21C4, U+2B01 and U+279C get none; U+2192 still gets->, U+21D0<=, and abanentry in the config still names a replacementtests/cases/banned_chars/arrowsandfix_arrows, each mixing a single-rule arrow with range arrows that point left, up and both ways->tests/corpus.rsthe_corpus_is_fixed_only_where_the_report_says: the arrowsfixleaves moved from the range-default reason (6 to 4) to the new no-replacement reason (0 to 2);make testpassesReferences