-
Notifications
You must be signed in to change notification settings - Fork 831
Use u8::try_from
#1121
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
Use u8::try_from
#1121
Conversation
|
lol, took me a while to see that little blighter :) |
BTW. I generally want to forbid |
@dpc propose a clippy lint if there isn't one? |
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.
ACK e077605eff98e266026e8e7ace7e693bb6b77545
The commit message still says |
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.
ACK e077605eff98e266026e8e7ace7e693bb6b77545
Damn, its hard to get good help huh. I only changed the PR title. |
Currently we use a cast to get the `u8` depth, as suggested by the TODO in the code we can now use `TryFrom` since we bumped the MSRV. Use `u8::try_from.expect("")` since, assuming the code comment is correct, the depth is guaranteed to be less that 127.
e077605
to
517059e
Compare
Fixed commit log, no other changes in force push. |
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.
ACK 517059e
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.
ACK 517059e
https://rust-lang.github.io/rust-clippy/master/#as_conversions |
517059e Use u8::try_from (Tobin C. Harding) Pull request description: Currently we use a cast to get the `u8` depth, as suggested by the TODO in the code we can now use `TryFrom` since we bumped the MSRV. Use `u8::try_from.expect("")` since depth (node count) is guarded by `TAPROOT_CONTROL_MAX_NODE_COUNT`. ACKs for top commit: Kixunil: ACK 517059e apoelstra: ACK 517059e Tree-SHA512: 98e58617247a05025ec13ad3d00a464cb2351c98c6d871be43b252d3982e291b7187e25780e7fe367f5a3a64fa20f3b328876a8901af4da09e675f50727a26cf
Currently we use a cast to get the
u8
depth, as suggested by the TODO in the code we can now useTryFrom
since we bumped the MSRV.Use
u8::try_from.expect("")
since depth (node count) is guarded byTAPROOT_CONTROL_MAX_NODE_COUNT
.