refactor(tvix/nix-compat): operator precedence can trip the unwary
warning: operator precedence can trip the unwary --> nix-compat/src/nixbase32.rs:41:23 | 41 | c |= ((input[i + 1] as u16) << 8 - j as u16) as u8 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider parenthesizing your expression: `(input[i + 1] as u16) << (8 - j as u16)` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#precedence = note: `#[warn(clippy::precedence)]` on by default Change-Id: I091071d649abf4ed38f5f4e39a0c5d21a0459bff Reviewed-on: https://cl.tvl.fyi/c/depot/+/7996 Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
This commit is contained in:
parent
361ffd7903
commit
2551adb4f1
1 changed files with 1 additions and 1 deletions
|
@ -38,7 +38,7 @@ pub fn encode(input: &[u8]) -> String {
|
||||||
// we want to right shift, and discard shifted out bits (unchecked)
|
// we want to right shift, and discard shifted out bits (unchecked)
|
||||||
// To do this without panicing, we need to do the shifting in u16
|
// To do this without panicing, we need to do the shifting in u16
|
||||||
// and convert back to u8 afterwards.
|
// and convert back to u8 afterwards.
|
||||||
c |= ((input[i + 1] as u16) << 8 - j as u16) as u8
|
c |= ((input[i + 1] as u16) << (8 - j as u16)) as u8
|
||||||
}
|
}
|
||||||
|
|
||||||
output
|
output
|
||||||
|
|
Loading…
Reference in a new issue