This commit is contained in:
Paul Masurel
2022-08-20 13:01:33 +02:00
committed by GitHub
parent ce45889add
commit 4a3169011d
5 changed files with 10 additions and 6 deletions

View File

@@ -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![];
@@ -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]

View File

@@ -1,3 +1,5 @@
#![allow(clippy::derive_partial_eq_without_eq)]
mod occur;
mod query_grammar;
mod user_input_ast;

View File

@@ -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`
//!

View File

@@ -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)),

View File

@@ -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);