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
This code can panic for two reasons: 1) fingerprints contains more than BUCKET_SIZE chunks; 2) fingerprints can't be divided evenly into FINGERPRINT_SIZEd chunks (slice_copy forwards to [T]::copy_from_slice which panics if slices have different lengths). However, the documentation for From trait explicitly claims that conversions defined through From::from should be infallible.
The correct solution in this case would be redo this code into TryFrom impl. Of course, this would break backwards compatibility.
The text was updated successfully, but these errors were encountered:
The following code is problematic:
https://github.com/seiflotfy/rust-cuckoofilter/blob/c7fea791f1c21deda02a263e69f0fec428e10c61/src/bucket.rs#L96-L105
This code can panic for two reasons: 1)
fingerprints
contains more thanBUCKET_SIZE
chunks; 2)fingerprints
can't be divided evenly intoFINGERPRINT_SIZE
d chunks (slice_copy
forwards to[T]::copy_from_slice
which panics if slices have different lengths). However, the documentation forFrom
trait explicitly claims that conversions defined throughFrom::from
should be infallible.The correct solution in this case would be redo this code into
TryFrom
impl. Of course, this would break backwards compatibility.The text was updated successfully, but these errors were encountered: