-
-
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
validator_os
takes &OsStr
, but validator
takes String
#1165
Comments
This is kind of related to #848 and I plan on re-working the signature of these methods in v3 (see #1037). The reason |
Bottom line, this is something I've been wanting to change and put more thought into but couldn't without a breaking change. Hindsight is always 20/20 and I wish I'd done it differently prior 😄 |
Having looked at the the code, this is the only place validators play: Lines 138 to 159 in 5b9dbee
Essentially, we could just replace
with
And change the signature for This kind of change won't give us any perf improvement, but it will make the API uniform (both Side note: as of now, if both |
I don't think it would make sense to have both, as all |
None I can think of. I'll make it panic in case both have been passed. |
If find it somewhat inconsistent that one function borrows the value, while the other takes it by value. It is very unlikely that anyone just forwards the argument passed to the
Err
return value, so there's no benefit of offering users an ownedString
.Full disclosure: It clashes with a clippy lint, and I don't know how to act on it: rust-lang/rust-clippy#2434
The text was updated successfully, but these errors were encountered: