diff --git a/bitpacker/benches/bench.rs b/bitpacker/benches/bench.rs index 7b61ce7993..7544687c21 100644 --- a/bitpacker/benches/bench.rs +++ b/bitpacker/benches/bench.rs @@ -6,12 +6,9 @@ extern crate test; mod tests { use rand::seq::IteratorRandom; use rand::thread_rng; - use tantivy_bitpacker::BitPacker; - use tantivy_bitpacker::BitUnpacker; - use tantivy_bitpacker::BlockedBitpacker; + use tantivy_bitpacker::{BitPacker, BitUnpacker, BlockedBitpacker}; use test::Bencher; - #[inline(never)] fn create_bitpacked_data(bit_width: u8, num_els: u32) -> Vec { let mut bitpacker = BitPacker::new(); diff --git a/bitpacker/src/bitpacker.rs b/bitpacker/src/bitpacker.rs index d84382b2a4..d21532db5a 100644 --- a/bitpacker/src/bitpacker.rs +++ b/bitpacker/src/bitpacker.rs @@ -135,7 +135,7 @@ mod test { bitpacker.write(val, num_bits, &mut data).unwrap(); } bitpacker.close(&mut data).unwrap(); - assert_eq!(data.len(), ((num_bits as usize) * len + 7) / 8 + 7); + assert_eq!(data.len(), ((num_bits as usize) * len + 7) / 8); let bitunpacker = BitUnpacker::new(num_bits); (bitunpacker, vals, data) } @@ -159,13 +159,7 @@ mod test { use proptest::prelude::*; fn num_bits_strategy() -> impl Strategy { - prop_oneof!( - Just(0), - Just(1), - 2u8..56u8, - Just(56), - Just(64), - ) + prop_oneof!(Just(0), Just(1), 2u8..56u8, Just(56), Just(64),) } fn vals_strategy() -> impl Strategy)> { @@ -189,12 +183,11 @@ mod test { bitpacker.flush(&mut buffer).unwrap(); assert_eq!(buffer.len(), (vals.len() * num_bits as usize + 7) / 8); let bitunpacker = BitUnpacker::new(num_bits); - let max_val = - if num_bits == 64 { - u64::MAX - } else { - (1u64 << num_bits) - 1 - }; + let max_val = if num_bits == 64 { + u64::MAX + } else { + (1u64 << num_bits) - 1 + }; for (i, val) in vals.iter().copied().enumerate() { assert!(val <= max_val); assert_eq!(bitunpacker.get(i as u32, &buffer), val); diff --git a/fastfield_codecs/src/serialize.rs b/fastfield_codecs/src/serialize.rs index def0c450eb..2609ce66d9 100644 --- a/fastfield_codecs/src/serialize.rs +++ b/fastfield_codecs/src/serialize.rs @@ -402,8 +402,8 @@ mod tests { let mut buffer = Vec::new(); let col = VecColumn::from(&[false, true][..]); serialize(col, &mut buffer, &ALL_CODEC_TYPES).unwrap(); - // 5 bytes of header, 1 byte of value, 7 bytes of padding. - assert_eq!(buffer.len(), 3 + 5 + 8 + 4 + 2); + // 5 bytes of header, 1 byte of value + assert_eq!(buffer.len(), 3 + 5 + 1 + 4 + 2); } #[test] @@ -411,8 +411,8 @@ mod tests { let mut buffer = Vec::new(); let col = VecColumn::from(&[true][..]); serialize(col, &mut buffer, &ALL_CODEC_TYPES).unwrap(); - // 5 bytes of header, 0 bytes of value, 7 bytes of padding. - assert_eq!(buffer.len(), 3 + 5 + 7 + 4 + 2); + // 5 bytes of header, 0 bytes of value + assert_eq!(buffer.len(), 3 + 5 + 4 + 2); } #[test] @@ -422,6 +422,6 @@ mod tests { let col = VecColumn::from(&vals[..]); serialize(col, &mut buffer, &[FastFieldCodecType::Bitpacked]).unwrap(); // Values are stored over 3 bits. - assert_eq!(buffer.len(), 3 + 7 + (3 * 80 / 8) + 7 + 4 + 2); + assert_eq!(buffer.len(), 3 + 7 + (3 * 80 / 8) + 4 + 2); } } diff --git a/run-tests.sh b/run-tests.sh deleted file mode 100755 index c179d0f6df..0000000000 --- a/run-tests.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -cargo test