diff options
-rw-r--r-- | src/common/bitpacker.rs | 5 | ||||
-rw-r--r-- | src/query/boolean_query/mod.rs | 6 | ||||
-rw-r--r-- | src/store/reader.rs | 5 |
3 files changed, 10 insertions, 6 deletions
diff --git a/src/common/bitpacker.rs b/src/common/bitpacker.rs index 1a8b820..fe94745 100644 --- a/src/common/bitpacker.rs +++ b/src/common/bitpacker.rs @@ -120,7 +120,8 @@ impl BitUnpacker { let addr = (idx * self.num_bits) / 8; let bit_shift = idx * self.num_bits - addr * 8; let val_unshifted_unmasked: u64; - debug_assert!(addr + 8 <= self.data_len, "The fast field field should have been padded with 7 bytes."); + debug_assert!(addr + 8 <= self.data_len, + "The fast field field should have been padded with 7 bytes."); val_unshifted_unmasked = unsafe { *(self.data_ptr.offset(addr as isize) as *const u64) }; let val_shifted = (val_unshifted_unmasked >> bit_shift) as u64; (val_shifted & self.mask) @@ -129,7 +130,7 @@ impl BitUnpacker { - + #[cfg(test)] mod test { use super::{BitPacker, BitUnpacker, compute_num_bits}; diff --git a/src/query/boolean_query/mod.rs b/src/query/boolean_query/mod.rs index c9dfdfb..01ef9e8 100644 --- a/src/query/boolean_query/mod.rs +++ b/src/query/boolean_query/mod.rs @@ -113,7 +113,8 @@ mod tests { let occurs = vec![Occur::Should, Occur::Should]; let occur_filter = OccurFilter::new(&occurs); - let left_fieldnorms = U64FastFieldReader::from((0u64..9u64).map(|doc| doc*3).collect::<Vec<u64>>()); + let left_fieldnorms = + U64FastFieldReader::from((0u64..9u64).map(|doc| doc * 3).collect::<Vec<u64>>()); let left = VecPostings::from(vec![1, 2, 3]); let left_scorer = TermScorer { @@ -122,7 +123,8 @@ mod tests { postings: left, }; - let right_fieldnorms = U64FastFieldReader::from((0u64..9u64).map(|doc| doc*5).collect::<Vec<u64>>()); + let right_fieldnorms = + U64FastFieldReader::from((0u64..9u64).map(|doc| doc * 5).collect::<Vec<u64>>()); let right = VecPostings::from(vec![1, 3, 8]); let right_scorer = TermScorer { diff --git a/src/store/reader.rs b/src/store/reader.rs index 060be45..5569a11 100644 --- a/src/store/reader.rs +++ b/src/store/reader.rs @@ -64,7 +64,6 @@ impl StoreReader { } } -#[allow(needless_pass_by_value)] fn split_source(data: ReadOnlySource) -> (ReadOnlySource, ReadOnlySource, DocId) { let data_len = data.len(); let footer_offset = data_len - size_of::<u64>() - size_of::<u32>(); @@ -73,7 +72,9 @@ fn split_source(data: ReadOnlySource) -> (ReadOnlySource, ReadOnlySource, DocId) let offset = u64::deserialize(&mut serialized_offset_buf).unwrap(); let offset = offset as usize; let max_doc = u32::deserialize(&mut serialized_offset_buf).unwrap(); - (data.slice(0, offset), data.slice(offset, footer_offset), max_doc) + let res = (data.slice(0, offset), data.slice(offset, footer_offset), max_doc); + drop(data); + res } |