From d3eabd14bc31d96b8b2d2ed3c2c4c8a45834c6bb Mon Sep 17 00:00:00 2001 From: Paul Masurel Date: Mon, 22 Apr 2019 10:27:42 +0900 Subject: [PATCH] Clippy comments Clippy complaints that about the cast of &[u32] to a *const __m128i, because of the lack of alignment constraints. This commit passes the OutputBuffer object (which enforces proper alignment) instead of `&[u32]`. --- src/postings/block_search.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/postings/block_search.rs b/src/postings/block_search.rs index 825eb9b7d..1cea9ffaf 100644 --- a/src/postings/block_search.rs +++ b/src/postings/block_search.rs @@ -127,14 +127,12 @@ impl BlockSearcher { /// then we use a different implementation that does an exhaustive linear search over /// the full block whenever the block is full (`len == 128`). It is surprisingly faster, most likely because of the lack /// of branch. - pub fn search_in_block(&self, block_docs: &[u32], start: usize, target: u32) -> usize { + pub fn search_in_block(self, block_docs: &[u32], start: usize, target: u32) -> usize { #[cfg(target_arch = "x86_64")] { use postings::compression::COMPRESSION_BLOCK_SIZE; - if *self == BlockSearcher::SSE2 { - if block_docs.len() == COMPRESSION_BLOCK_SIZE { - return sse2::linear_search_sse2_128(block_docs, target); - } + if self == BlockSearcher::SSE2 && block_docs.len() == COMPRESSION_BLOCK_SIZE { + return sse2::linear_search_sse2_128(block_docs, target); } } start + galloping(&block_docs[start..], target)