manual clippy fixes

This commit is contained in:
Vinzenz Schroeter 2024-05-15 23:14:38 +02:00
parent b0de3a4fb5
commit 237ca6d6a2
2 changed files with 13 additions and 2 deletions

View file

@ -76,6 +76,11 @@ impl BitVec {
self.data.len() * 8
}
/// returns true if length is 0.
pub fn is_empty(&self) -> bool {
self.data.is_empty()
}
/// Get the underlying bits in their raw packed bytes form
pub fn mut_data_ref(&mut self) -> &mut [u8] {
self.data.as_mut_slice()
@ -174,6 +179,12 @@ pub mod c_api {
(*this).len()
}
/// Returns true if length is 0.
#[no_mangle]
pub unsafe extern "C" fn sp2_bit_vec_is_empty(this: *const BitVec) -> bool {
(*this).is_empty()
}
/// Gets an unsafe reference to the data of the `BitVec` instance.
///
/// ## Safety

View file

@ -93,7 +93,7 @@ pub(crate) fn into_compressed(
let mut encoder = Lz4EncoderBuilder::new()
.build(vec![])
.expect("could not create encoder");
encoder.write(&payload).expect("could not write payload");
encoder.write_all(&payload).expect("could not write payload");
let (payload, _) = encoder.finish();
payload
}
@ -103,7 +103,7 @@ pub(crate) fn into_compressed(
ZstdEncoder::new(vec![], zstd::DEFAULT_COMPRESSION_LEVEL)
.expect("could not create encoder");
encoder
.write(&payload)
.write_all(&payload)
.expect("could not compress payload");
encoder.finish().expect("could not finish encoding")
}