-
Notifications
You must be signed in to change notification settings - Fork 790
Make SpotifyId base62 / base16 methods infallible #1635
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
Make SpotifyId base62 / base16 methods infallible #1635
Conversation
The only error case is a non-utf8 string, which is impossible since we're building it from a fixed alphabet. This allows removing a bunch of unnecessary error handling branches.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wanted to asked about the
write!().unwrap()call infile_id.rs, but as it turns out some searching and understanding gives the answer.fmt::Write for String never returns an error itself
Seems like a reasonable change. Please add a changelog entry to give this the final touch, then we could probably merge this.
361a09d to
f2e80f0
Compare
|
Thanks for the change :) |
|
Just found out that |
|
Oh, nice find, I can do a quick PR for that too. |
|
If you want to, go for it :) |
For both of these, the only error case is a non-utf8 string, which is impossible since we're building it from a fixed alphabet.
This allows removing a bunch of unnecessary error handling branches.
Also, for base16, there's no need to implement parsing/formatting, just use the stdlib's hex conversion/formatting code.