You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are some decisions I have to ask you first before completing and asking for a complete review:
It seems that other implementations of uniq ignore the trailing '\n' at the end of the lines, but does not ignore '\r', what is the desired behavior for me to implement? (I know that this project is only meant to be used in Windows, but \r\n files are still possible).
In Rust we usually deal with UTF-8 encoded text, it happens that the -s flag, commonly named --skip-chars, does not skip UTF-8 chars, but bytes instead (other implementations), see this example:
uniq -s 1
é verdade
ó verdade
a verdade
Uniq will display the 3 lines received.
The problem when comparing different slices of bytes is that:
let text = "não";let slice = &text[2..];
Throws a runtime panic, because of the multi-byte char 'ã'.
Should I just work this around by using .as_bytes() instead of string slices?
About -s previous errors, the output wasn't showing the full line that first matched with the "pattern". I'll fix tests soon.
Nowadays almost all editors supports windows like line-ending, so I think if a file has it, and it is followed by a "\n" it should be have the same behavior as "\n"
There is something specifying that in the -s should consider only ASCII in the specification? If there isn't I think it should handle UTF-8 gracefully, otherwise, it would be a cool extension a new flag that handles UTF-8
I didn't had the time to look a the code yet, but I'll check as soon as possible
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
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.
There are some decisions I have to ask you first before completing and asking for a complete review:
uniqignore the trailing'\n'at the end of the lines, but does not ignore'\r', what is the desired behavior for me to implement? (I know that this project is only meant to be used in Windows, but \r\n files are still possible).-sflag, commonly named--skip-chars, does not skip UTF-8 chars, but bytes instead (other implementations), see this example:Uniq will display the 3 lines received.
The problem when comparing different slices of bytes is that:
Throws a runtime panic, because of the multi-byte char
'ã'.Should I just work this around by using
.as_bytes()instead of string slices?About
-sprevious errors, the output wasn't showing the full line that first matched with the "pattern". I'll fix tests soon.