mirror of
https://github.com/arnaucube/miden-crypto.git
synced 2026-01-09 15:41:30 +01:00
config: add rustfmt config
This commit is contained in:
@@ -270,10 +270,7 @@ impl Blake3_160 {
|
||||
/// Zero-copy ref shrink to array.
|
||||
fn shrink_bytes<const M: usize, const N: usize>(bytes: &[u8; M]) -> &[u8; N] {
|
||||
// compile-time assertion
|
||||
assert!(
|
||||
M >= N,
|
||||
"N should fit in M so it can be safely transmuted into a smaller slice!"
|
||||
);
|
||||
assert!(M >= N, "N should fit in M so it can be safely transmuted into a smaller slice!");
|
||||
// safety: bytes len is asserted
|
||||
unsafe { transmute(bytes) }
|
||||
}
|
||||
|
||||
@@ -118,14 +118,13 @@ impl Ord for RpoDigest {
|
||||
// finally, we use `Felt::inner` instead of `Felt::as_int` so we avoid performing a
|
||||
// montgomery reduction for every limb. that is safe because every inner element of the
|
||||
// digest is guaranteed to be in its canonical form (that is, `x in [0,p)`).
|
||||
self.0
|
||||
.iter()
|
||||
.map(Felt::inner)
|
||||
.zip(other.0.iter().map(Felt::inner))
|
||||
.fold(Ordering::Equal, |ord, (a, b)| match ord {
|
||||
self.0.iter().map(Felt::inner).zip(other.0.iter().map(Felt::inner)).fold(
|
||||
Ordering::Equal,
|
||||
|ord, (a, b)| match ord {
|
||||
Ordering::Equal => a.cmp(&b),
|
||||
_ => ord,
|
||||
})
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user