-
Notifications
You must be signed in to change notification settings - Fork 196
Drive-by changes nagged about by clippy #1007
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
Conversation
Thanks for the work. I think you need to test it under 32-bit as well as feature flags like |
Fixed. It doesn't really help that many unittests fail when compiled with |
You'd also need to back out the tests with |
I don't understand what you mean I'm afraid.
|
Sorry, I made a mistake. It will cause problem when not using // Original
#[allow(clippy::cast_sign_loss, clippy::cast_possible_truncation)]
let len = len.min(MAX_USIZE_INT) as usize;
// New
let len = len as usize; The new version is problematic. Consider a 32-bit CPU where Casting It currently does not cause a CI failure simply because our CI does not fully test edge cases. The tests are actually extremely minimal coverage... Also not many people have fully tested Rhai on 32-bit (although I sometimes run CI on 32-bit target once in a blue moon). Adding 32-bit tests into CI doesn't help unless the edge-case tests are added. It'd not even prop up during fuzzing unless fuzzing on a 32-bit machine. Edit: ChangesActually, this is old code. It should be much more idiomatic to use |
|
Yup, and this is what I'm doing. I'm almost done, but still need to comb through carefully just in case I make a mistake. Maybe it'd be better for you to wait for my commit and then rebase off that. There will be quite a number of changes to change all implicit castings to The goal is to remove as many |
@therealprof Please try to rebase off the latest drop. I have replaced most non-trivial castings with |
Signed-off-by: Daniel Egger <daniel@eggers-club.de>
ec0d6d4
to
024f68b
Compare
Done... Not entirely sure I agree with the gobs of new unwrapping making Rhai safer than the hard casting but well. |
Well, with hard casting I always have to check it very carefully for edge cases, and a lot of times I screw up only for it to come back via fuzzing. Not that fuzzing can catch all...
|
No description provided.