-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Potentially unjustified unsafe
#1054
Comments
Agreed! I think those were either left over from old code, or under assumptions that only ascii code would be supported. Both of which seem wrong now. The debug code one I actually want to look up I'd be good with a PR removing these uses if someone wants a quick PR! |
Awesome, in this case I'll open a PR soon! |
There are two more instances of If this is However, better yet,
|
The second one is: Wouldn't be it better to, instead of creating our own |
I'm good trying this method if it can be implemented in a non-breaking manner. Even as unfortunate as it is, if we can't do this in a non-breaking way it'll have to wait.
This was written before the actual |
"Non-breaking" meaning retaining the incorrect behavior with regards to the separator, or leaving it
Sure, will try to do that as well, then! |
I mean non breaking, meaning change of user code with the exception of correcting a bugfix like you stated. Specifically, I'm talking about removing Thanks for tackling all this by the way! |
Oooh, alright. Sure thing – of course I'm advocating for making these changes without user code having to change. My suggestion about "giving users the control over And indeed there may be no non-breaking way to remove And, as always — you are welcome! I'm happy to improve libraries that I love. |
This has been resolved via #1058. |
There are a couple of uses of
unsafe
in the code that I think are not strictly necessary. The prime example is this:https://github.com/kbknapp/clap-rs/blob/6e948994a61e389c8f3b6726435d3d14bdd328bb/src/app/parser.rs#L1350-L1362
I understand that this instance of
unsafe
might have been introduced for performance reasons, however I don't think giving up safety is a clear win here. When printing help text for the user, I/O time probably dominates UTF-8 validation time, and help texts aren't enormously long either, usually (typically at most in the tens of kilobytes).Similarly, in https://github.com/kbknapp/clap-rs/blob/6e948994a61e389c8f3b6726435d3d14bdd328bb/src/app/help.rs#L850-L855
it seems highly unlikely to me that a debug build would experience a bottleneck in the UTF-8 validation of this one method.
The text was updated successfully, but these errors were encountered: