Cast after calling min
In an effort to reduce the cognitive load of reading code we are removing casts unless they are useful or obvious. Move the cast onto the call to `min` and comment it for good measure. This allows us to call infallible `from` for conversion when needed. Refactor only, no logic changes.
This commit is contained in:
parent
342fe18ad0
commit
ea9f6e8f97
|
@ -435,9 +435,9 @@ impl GcsFilter {
|
||||||
let mut wrote = 0;
|
let mut wrote = 0;
|
||||||
let mut q = n >> self.p;
|
let mut q = n >> self.p;
|
||||||
while q > 0 {
|
while q > 0 {
|
||||||
let nbits = cmp::min(q, 64);
|
let nbits = cmp::min(q, 64) as u8; // cast ok, 64 fits into a `u8`
|
||||||
wrote += writer.write(!0u64, nbits as u8)?;
|
wrote += writer.write(!0u64, nbits)?;
|
||||||
q -= nbits;
|
q -= u64::from(nbits);
|
||||||
}
|
}
|
||||||
wrote += writer.write(0, 1)?;
|
wrote += writer.write(0, 1)?;
|
||||||
wrote += writer.write(n, self.p)?;
|
wrote += writer.write(n, self.p)?;
|
||||||
|
|
Loading…
Reference in New Issue