Skip to content

Commit

Permalink
clippy (#1452)
Browse files Browse the repository at this point in the history
  • Loading branch information
fulmicoton authored and PSeitz committed Aug 22, 2022
1 parent ce45889 commit 737d11f
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
10 changes: 6 additions & 4 deletions bitpacker/src/blocked_bitpacker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ fn metadata_test() {
assert_eq!(meta.num_bits(), 6);
}

fn mem_usage<T>(items: &Vec<T>) -> usize {
items.capacity() * std::mem::size_of::<T>()
}

impl BlockedBitpacker {
pub fn new() -> Self {
let mut compressed_blocks = vec![];
Expand All @@ -73,10 +77,8 @@ impl BlockedBitpacker {
pub fn mem_usage(&self) -> usize {
std::mem::size_of::<BlockedBitpacker>()
+ self.compressed_blocks.capacity()
+ self.offset_and_bits.capacity()
* std::mem::size_of_val(&self.offset_and_bits.get(0).cloned().unwrap_or_default())
+ self.buffer.capacity()
* std::mem::size_of_val(&self.buffer.get(0).cloned().unwrap_or_default())
+ mem_usage(&self.offset_and_bits)
+ mem_usage(&self.buffer)
}

#[inline]
Expand Down
2 changes: 2 additions & 0 deletions query-grammar/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(clippy::derive_partial_eq_without_eq)]

mod occur;
mod query_grammar;
mod user_input_ast;
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#![doc(test(attr(allow(unused_variables), deny(warnings))))]
#![warn(missing_docs)]
#![allow(clippy::len_without_is_empty)]
#![allow(clippy::derive_partial_eq_without_eq)]

//! # `tantivy`
//!
Expand Down
2 changes: 1 addition & 1 deletion src/query/query_parser/query_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ pub struct QueryParser {
fn all_negative(ast: &LogicalAst) -> bool {
match ast {
LogicalAst::Leaf(_) => false,
LogicalAst::Boost(ref child_ast, _) => all_negative(&*child_ast),
LogicalAst::Boost(ref child_ast, _) => all_negative(child_ast),
LogicalAst::Clause(children) => children
.iter()
.all(|(ref occur, child)| (*occur == Occur::MustNot) || all_negative(child)),
Expand Down
1 change: 0 additions & 1 deletion src/query/union.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ where

// The target is outside of the buffered horizon.
// advance all docsets to a doc >= to the target.
#[cfg_attr(feature = "cargo-clippy", allow(clippy::clippy::collapsible_if))]
unordered_drain_filter(&mut self.docsets, |docset| {
if docset.doc() < target {
docset.seek(target);
Expand Down

0 comments on commit 737d11f

Please sign in to comment.