Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions bitpacker/src/bitpacker.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// manual divceil actually generates code that is not optimal (to accept the full range of u32) and
// perf matters here.
#![allow(clippy::manual_div_ceil)]

use std::io;
use std::ops::{Range, RangeInclusive};

Expand Down
5 changes: 2 additions & 3 deletions bitpacker/src/blocked_bitpacker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,9 @@ impl BlockedBitpacker {
pub fn iter(&self) -> impl Iterator<Item = u64> + '_ {
// todo performance: we could decompress a whole block and cache it instead
let bitpacked_elems = self.offset_and_bits.len() * BLOCK_SIZE;
let iter = (0..bitpacked_elems)
(0..bitpacked_elems)
.map(move |idx| self.get(idx))
.chain(self.buffer.iter().cloned());
iter
.chain(self.buffer.iter().cloned())
}
}

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

mod bitpacker;
mod blocked_bitpacker;
mod filter_vec;
Expand Down
2 changes: 2 additions & 0 deletions columnar/src/columnar/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(clippy::manual_div_ceil)]

mod column_type;
mod format_version;
mod merge;
Expand Down
2 changes: 1 addition & 1 deletion columnar/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
//! column.
//! - [column_values]: Stores the values of a column in a dense format.

#![cfg_attr(all(feature = "unstable", test), feature(test))]
// #![cfg_attr(all(feature = "unstable", test), feature(test))]

#[cfg(test)]
#[macro_use]
Expand Down
3 changes: 2 additions & 1 deletion common/src/bitset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::ByteCount;
pub struct TinySet(u64);

impl fmt::Debug for TinySet {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
self.into_iter().collect::<Vec<u32>>().fmt(f)
}
}
Expand Down Expand Up @@ -182,6 +182,7 @@ pub struct BitSet {
max_value: u32,
}

#[inline(always)]
fn num_buckets(max_val: u32) -> u32 {
(max_val + 63u32) / 64u32
}
Expand Down
4 changes: 3 additions & 1 deletion common/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#![allow(clippy::len_without_is_empty)]
// manual divceil actually generates code that is not optimal (to accept the full range of u32) and
// perf matters here.
#![allow(clippy::len_without_is_empty, clippy::manual_div_ceil)]

use std::ops::Deref;

Expand Down
5 changes: 2 additions & 3 deletions query-grammar/src/query_grammar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,15 +305,14 @@ fn term_group_infallible(inp: &str) -> JResult<&str, UserInputAst> {
let (inp, (field_name, _, _, _)) =
tuple((field_name, multispace0, char('('), multispace0))(inp).expect("precondition failed");

let res = delimited_infallible(
delimited_infallible(
nothing,
map(ast_infallible, |(mut ast, errors)| {
ast.set_default_field(field_name.to_string());
(ast, errors)
}),
opt_i_err(char(')'), "expected ')'"),
)(inp);
res
)(inp)
}

fn exists(inp: &str) -> IResult<&str, UserInputLeaf> {
Expand Down
1 change: 0 additions & 1 deletion src/collector/facet_collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,6 @@ impl FacetCounts {
#[cfg(test)]
mod tests {
use std::collections::BTreeSet;
use std::iter;

use columnar::Dictionary;
use rand::distributions::Uniform;
Expand Down
3 changes: 0 additions & 3 deletions src/positions/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ const COMPRESSION_BLOCK_SIZE: usize = BitPacker4x::BLOCK_LEN;

#[cfg(test)]
pub(crate) mod tests {

use std::iter;

use proptest::prelude::*;
use proptest::sample::select;

Expand Down
1 change: 0 additions & 1 deletion src/query/boolean_query/block_wand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,6 @@ fn is_sorted<I: Iterator<Item = DocId>>(mut it: I) -> bool {
mod tests {
use std::cmp::Ordering;
use std::collections::BinaryHeap;
use std::iter;

use proptest::prelude::*;

Expand Down
2 changes: 0 additions & 2 deletions src/tokenizer/ascii_folding_filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1561,8 +1561,6 @@ fn to_ascii(text: &str, output: &mut String) {

#[cfg(test)]
mod tests {
use std::iter;

use super::to_ascii;
use crate::tokenizer::{AsciiFoldingFilter, RawTokenizer, SimpleTokenizer, TextAnalyzer};

Expand Down
14 changes: 6 additions & 8 deletions sstable/src/dictionary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,10 +308,9 @@ impl<TSSTable: SSTable> Dictionary<TSSTable> {
}
}
_ => {
return Err(io::Error::new(
io::ErrorKind::Other,
format!("Unsupported sstable version, expected one of [2, 3], found {version}"),
));
return Err(io::Error::other(format!(
"Unsupported sstable version, expected one of [2, 3], found {version}"
)));
}
};

Expand Down Expand Up @@ -697,10 +696,9 @@ mod tests {
fn read_bytes(&self, range: Range<usize>) -> std::io::Result<OwnedBytes> {
let allowed_range = self.allowed_range.lock().unwrap();
if !allowed_range.contains(&range.start) || !allowed_range.contains(&(range.end - 1)) {
return Err(std::io::Error::new(
std::io::ErrorKind::Other,
format!("invalid range, allowed {allowed_range:?}, requested {range:?}"),
));
return Err(std::io::Error::other(format!(
"invalid range, allowed {allowed_range:?}, requested {range:?}"
)));
}

Ok(self.bytes.slice(range))
Expand Down
2 changes: 2 additions & 0 deletions sstable/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(clippy::manual_div_ceil)]

//! `tantivy_sstable` is a crate that provides a sorted string table data structure.
//!
//! It is used in `tantivy` to store the term dictionary.
Expand Down
2 changes: 1 addition & 1 deletion sstable/src/sstable_index_v3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ impl SSTableIndexBuilder {

fn fst_error_to_io_error(error: tantivy_fst::Error) -> io::Error {
match error {
tantivy_fst::Error::Fst(fst_error) => io::Error::new(io::ErrorKind::Other, fst_error),
tantivy_fst::Error::Fst(fst_error) => io::Error::other(fst_error),
tantivy_fst::Error::Io(ioerror) => ioerror,
}
}
Expand Down
3 changes: 1 addition & 2 deletions stacker/src/fastcpy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ pub fn fast_short_slice_copy(src: &[u8], dst: &mut [u8]) {
#[track_caller]
fn len_mismatch_fail(dst_len: usize, src_len: usize) -> ! {
panic!(
"source slice length ({}) does not match destination slice length ({})",
src_len, dst_len,
"source slice length ({src_len}) does not match destination slice length ({dst_len})",
);
}

Expand Down
2 changes: 0 additions & 2 deletions stacker/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![cfg_attr(all(feature = "unstable", test), feature(test))]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is now forbidden in stable. Can you investigate what you want to do with this?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can just move all benches to binggan


#[cfg(all(test, feature = "unstable"))]
extern crate test;

Expand Down
Loading