-
Notifications
You must be signed in to change notification settings - Fork 94
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
remove unnecessary unsafe block #1515
Conversation
@ozkanonur It was already done in this PR: #1514 |
Signed-off-by: ozkanonur <work@onurozkan.dev>
03fba7e
to
31e1a97
Compare
There shouldn't be problem because even if
|
I guess we have a condition that checks if bigger than |
Yes, that would be true if we casted
|
It's same for all castings from a type that supports bigger value to type support smaller value. eg: fn main() {
// MAX value of unsigned 32 byte + 10
let x: u64 = 4294967295 + 10;
assert_eq!(x as u32, std::u32::MAX, "{} is not {}", x as u32, std::u32::MAX);
} |
I was wrong... I thought I tested exactly the same case that you mentioned above, but it looks like I didn't... |
I will implement the safe-casting macros and update non-safe castings with using that macro. I will do it at weekend and make it r2r before monday morning. Today I have some debugging work on tendermint |
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.
👍
Signed-off-by: ozkanonur work@onurozkan.dev