mirror of
https://github.com/cccb/servicepoint.git
synced 2025-01-18 18:10:14 +01:00
manual clippy fixes
This commit is contained in:
parent
b0de3a4fb5
commit
237ca6d6a2
|
@ -76,6 +76,11 @@ impl BitVec {
|
||||||
self.data.len() * 8
|
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
|
/// Get the underlying bits in their raw packed bytes form
|
||||||
pub fn mut_data_ref(&mut self) -> &mut [u8] {
|
pub fn mut_data_ref(&mut self) -> &mut [u8] {
|
||||||
self.data.as_mut_slice()
|
self.data.as_mut_slice()
|
||||||
|
@ -174,6 +179,12 @@ pub mod c_api {
|
||||||
(*this).len()
|
(*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.
|
/// Gets an unsafe reference to the data of the `BitVec` instance.
|
||||||
///
|
///
|
||||||
/// ## Safety
|
/// ## Safety
|
||||||
|
|
|
@ -93,7 +93,7 @@ pub(crate) fn into_compressed(
|
||||||
let mut encoder = Lz4EncoderBuilder::new()
|
let mut encoder = Lz4EncoderBuilder::new()
|
||||||
.build(vec![])
|
.build(vec![])
|
||||||
.expect("could not create encoder");
|
.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();
|
let (payload, _) = encoder.finish();
|
||||||
payload
|
payload
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ pub(crate) fn into_compressed(
|
||||||
ZstdEncoder::new(vec![], zstd::DEFAULT_COMPRESSION_LEVEL)
|
ZstdEncoder::new(vec![], zstd::DEFAULT_COMPRESSION_LEVEL)
|
||||||
.expect("could not create encoder");
|
.expect("could not create encoder");
|
||||||
encoder
|
encoder
|
||||||
.write(&payload)
|
.write_all(&payload)
|
||||||
.expect("could not compress payload");
|
.expect("could not compress payload");
|
||||||
encoder.finish().expect("could not finish encoding")
|
encoder.finish().expect("could not finish encoding")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue