mirror of
https://github.com/logos-messaging/libchat.git
synced 2026-08-25 07:01:08 +00:00
chore: walk the device bundle in fixed-size chunks
Stable clippy rejects `chunks_exact` with a constant size in favour of `as_chunks`, which fails the lint job for the whole workspace, and reading fixed arrays out of the slice drops the length check the old code carried as an `expect`.
This commit is contained in:
@@ -156,12 +156,12 @@ pub fn decode_bundle_payload(payload: &[u8]) -> Result<DecodedBundle, BundleErro
|
||||
if body.len() != count * 32 {
|
||||
return Err(BundleError::Short);
|
||||
}
|
||||
let devices = body
|
||||
.chunks_exact(32)
|
||||
.map(|c| c.try_into().expect("chunks_exact(32) yields 32 bytes"))
|
||||
.collect();
|
||||
let (devices, _) = body.as_chunks::<32>();
|
||||
|
||||
Ok(DecodedBundle { lamport, devices })
|
||||
Ok(DecodedBundle {
|
||||
lamport,
|
||||
devices: devices.to_vec(),
|
||||
})
|
||||
}
|
||||
|
||||
/// Decode `bundle`, confirm it belongs to `expected_account`, and verify the
|
||||
|
||||
Reference in New Issue
Block a user