You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think that since there are so many tricky integer conversions, as casts should be linted for and denied throughout the codebase.
I didn't see any in particular, but they're so fickle that I think they're worth avoiding entirely, so you don't even have to think about whether or not an individual instance is correct.
One thing you can do to make this easier is to add a trait like this:
trait IntoUsize {
fn into_usize(self) -> usize;
}
And then implement it for all types smaller or equal to than minimum usize that redb supports. So since I think redb can only run on 32-bit-or-better systems, u8, u16, and u32 could all implement IntoUsize, which would get rid of a ton of the remaining as conversions.
The text was updated successfully, but these errors were encountered:
I think that since there are so many tricky integer conversions,
as
casts should be linted for and denied throughout the codebase.I didn't see any in particular, but they're so fickle that I think they're worth avoiding entirely, so you don't even have to think about whether or not an individual instance is correct.
One thing you can do to make this easier is to add a trait like this:
And then implement it for all types smaller or equal to than minimum
usize
that redb supports. So since I thinkredb
can only run on 32-bit-or-better systems,u8
,u16
, andu32
could all implementIntoUsize
, which would get rid of a ton of the remainingas
conversions.The text was updated successfully, but these errors were encountered: