tr: fix octal interpretation of repeat count string#3178
Merged
tertsdiepraam merged 6 commits intomainfrom Feb 25, 2022
unknown repository
Merged
tr: fix octal interpretation of repeat count string#3178tertsdiepraam merged 6 commits intomainfrom unknown repository
tertsdiepraam merged 6 commits intomainfrom
unknown repository
Conversation
Member
tertsdiepraam
left a comment
There was a problem hiding this comment.
Clippy and spelling check found some issues, but looks like it's going in the right direction! Thanks!
src/uu/tr/src/operation.rs
Outdated
Comment on lines
282
to
287
| let result: Result<usize, ParseIntError>; | ||
| if cnt_str.chars().next().unwrap() == '0' { | ||
| result = usize::from_str_radix(cnt_str, 8); | ||
| } else { | ||
| result = usize::from_str_radix(cnt_str, 10); | ||
| }; |
Member
There was a problem hiding this comment.
Suggested change
| let result: Result<usize, ParseIntError>; | |
| if cnt_str.chars().next().unwrap() == '0' { | |
| result = usize::from_str_radix(cnt_str, 8); | |
| } else { | |
| result = usize::from_str_radix(cnt_str, 10); | |
| }; | |
| let result = cnt_str.starts_with('0') { | |
| usize::from_str_radix(cnt_str, 8); | |
| } else { | |
| usize::from_str_radix(cnt_str, 10); | |
| }; |
Author
There was a problem hiding this comment.
I fixed it. Do you know how can I fix the below?
Error: ERROR: Unknown word (abcdefghijkl) (file:'tests/by-util/test_tr.rs', line:876)
Error: ERROR: Unknown word (xxxxxxxxyyyymnop) (file:'tests/by-util/test_tr.rs', line:879)
Error: ERROR: Unknown word (abcdefghijkl) (file:'tests/by-util/test_tr.rs', line:886)
Error: ERROR: Unknown word (xxxxxxxxxxyymnop) (file:'tests/by-util/test_tr.rs', line:889)
Error: Process completed with exit code 1.
Member
There was a problem hiding this comment.
Thanks! You can add those "words" to the // spell-checker:ignore comments in that file.
Author
There was a problem hiding this comment.
This PR has way too many commits than I wanted. Will you be able to squash them while merging or should I try to squash them and send another PR?
Also, please review and let me know if this looks okay.
Member
|
All good! Thanks! |
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.
Closes #3168
Fix repeat count processing of
trto interpret as octal only if prefixed with0.