Style::from_dotted_str ignore non-ascii#287
Merged
Merged
Conversation
Contributor
Author
|
Hm.. I'm not sure why the lint run on windows failed (the others passed) |
Member
Pre-existing, should be fixed if you rebase: |
d9b0786 to
0ebc85f
Compare
Contributor
Author
|
Awesome, rebased and the checks look better now. |
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.
True colors were added to
Style::from_dotted_strin v0.16.2, but it seems like the string slicing only works for ascii (panicking for certain inputs).Of course, only ascii is expected as an input to the function, but I figured I'd raise this PR since the doc for that function ends with "Unknown terms are ignored". It seems unlikely (possible?) that someone would provide user-input to this function. At least the length check ensures we're not linearly checking ascii in any huge strings.
#[expect_panic]tests.#[expect_panic]to verify "Unknown terms are ignored".I identified this improvement while reviewing a delta in cargo-vet (myself).
I used AI to create the input strings that trigger both panic branches (as it's more familiar with UTF-8 details than me), but the commits and asserts are my own. I debated removing the comments the AI generated above the two inputs, but it seems like it helps document (at least against the current implementation). Feel free to adjust as you see fit.