3695: Update clippy toolchain from v1.67 to v1.69 r=Kerollmops a=curquiza



Co-authored-by: curquiza <clementine@meilisearch.com>
Co-authored-by: Clément Renault <clement@meilisearch.com>
This commit is contained in:
bors[bot] 2023-04-25 15:45:18 +00:00 committed by GitHub
commit 0fd5ab9fcc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 67 additions and 77 deletions

View File

@ -138,7 +138,7 @@ jobs:
- uses: actions-rs/toolchain@v1 - uses: actions-rs/toolchain@v1
with: with:
profile: minimal profile: minimal
toolchain: 1.67.0 toolchain: 1.69.0
override: true override: true
components: clippy components: clippy
- name: Cache dependencies - name: Cache dependencies

View File

@ -25,7 +25,6 @@ impl CompatV2ToV3 {
CompatV2ToV3::Compat(compat) => compat.index_uuid(), CompatV2ToV3::Compat(compat) => compat.index_uuid(),
}; };
v2_uuids v2_uuids
.into_iter()
.into_iter() .into_iter()
.map(|index| v3::meta::IndexUuid { uid: index.uid, uuid: index.uuid }) .map(|index| v3::meta::IndexUuid { uid: index.uid, uuid: index.uuid })
.collect() .collect()

View File

@ -1773,7 +1773,7 @@ async fn error_add_documents_payload_size() {
"content": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec metus erat, consequat in blandit venenatis, ultricies eu ipsum. Etiam luctus elit et mollis ultrices. Nam turpis risus, dictum non eros in, eleifend feugiat elit. Morbi non dolor pulvinar, sagittis mi sed, ultricies lorem. Nulla ultricies sem metus. Donec at suscipit quam, sed elementum mi. Suspendisse potenti. Fusce pharetra turpis tortor, sed eleifend odio dapibus ut. Nulla facilisi. Suspendisse elementum, dui eget aliquet dignissim, ex tellus aliquam nisl, at eleifend nisl metus tempus diam. Mauris fermentum sollicitudin efficitur. Donec dignissim est vitae elit finibus faucibus" "content": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec metus erat, consequat in blandit venenatis, ultricies eu ipsum. Etiam luctus elit et mollis ultrices. Nam turpis risus, dictum non eros in, eleifend feugiat elit. Morbi non dolor pulvinar, sagittis mi sed, ultricies lorem. Nulla ultricies sem metus. Donec at suscipit quam, sed elementum mi. Suspendisse potenti. Fusce pharetra turpis tortor, sed eleifend odio dapibus ut. Nulla facilisi. Suspendisse elementum, dui eget aliquet dignissim, ex tellus aliquam nisl, at eleifend nisl metus tempus diam. Mauris fermentum sollicitudin efficitur. Donec dignissim est vitae elit finibus faucibus"
} }
); );
let documents: Vec<_> = (0..16000).into_iter().map(|_| document.clone()).collect(); let documents: Vec<_> = (0..16000).map(|_| document.clone()).collect();
let documents = json!(documents); let documents = json!(documents);
let (response, code) = index.add_documents(documents, None).await; let (response, code) = index.add_documents(documents, None).await;
@ -1934,7 +1934,6 @@ async fn batch_several_documents_addition() {
let index = server.index("test"); let index = server.index("test");
let mut documents: Vec<_> = (0..150usize) let mut documents: Vec<_> = (0..150usize)
.into_iter()
.map(|id| { .map(|id| {
json!( json!(
{ {

View File

@ -561,7 +561,7 @@ mod tests {
#[test] #[test]
fn compute_combinations_1() { fn compute_combinations_1() {
let b0: RoaringBitmap = (0..).into_iter().map(|x| 2 * x).take_while(|x| *x < 150).collect(); let b0: RoaringBitmap = (0..).map(|x| 2 * x).take_while(|x| *x < 150).collect();
let parts_candidates = vec![b0]; let parts_candidates = vec![b0];
@ -575,8 +575,8 @@ mod tests {
#[test] #[test]
fn compute_combinations_2() { fn compute_combinations_2() {
let b0: RoaringBitmap = (0..).into_iter().map(|x| 2 * x).take_while(|x| *x < 150).collect(); let b0: RoaringBitmap = (0..).map(|x| 2 * x).take_while(|x| *x < 150).collect();
let b1: RoaringBitmap = (0..).into_iter().map(|x| 3 * x).take_while(|x| *x < 150).collect(); let b1: RoaringBitmap = (0..).map(|x| 3 * x).take_while(|x| *x < 150).collect();
let parts_candidates = vec![b0, b1]; let parts_candidates = vec![b0, b1];
@ -589,10 +589,10 @@ mod tests {
#[test] #[test]
fn compute_combinations_4() { fn compute_combinations_4() {
let b0: RoaringBitmap = (0..).into_iter().map(|x| 2 * x).take_while(|x| *x < 150).collect(); let b0: RoaringBitmap = (0..).map(|x| 2 * x).take_while(|x| *x < 150).collect();
let b1: RoaringBitmap = (0..).into_iter().map(|x| 3 * x).take_while(|x| *x < 150).collect(); let b1: RoaringBitmap = (0..).map(|x| 3 * x).take_while(|x| *x < 150).collect();
let b2: RoaringBitmap = (0..).into_iter().map(|x| 5 * x).take_while(|x| *x < 150).collect(); let b2: RoaringBitmap = (0..).map(|x| 5 * x).take_while(|x| *x < 150).collect();
let b3: RoaringBitmap = (0..).into_iter().map(|x| 7 * x).take_while(|x| *x < 150).collect(); let b3: RoaringBitmap = (0..).map(|x| 7 * x).take_while(|x| *x < 150).collect();
let parts_candidates = vec![b0, b1, b2, b3]; let parts_candidates = vec![b0, b1, b2, b3];
@ -610,10 +610,10 @@ mod tests {
} }
#[test] #[test]
fn compute_combinations_4_with_empty_results_at_end() { fn compute_combinations_4_with_empty_results_at_end() {
let b0: RoaringBitmap = (1..).into_iter().map(|x| 2 * x).take_while(|x| *x < 150).collect(); let b0: RoaringBitmap = (1..).map(|x| 2 * x).take_while(|x| *x < 150).collect();
let b1: RoaringBitmap = (1..).into_iter().map(|x| 3 * x).take_while(|x| *x < 150).collect(); let b1: RoaringBitmap = (1..).map(|x| 3 * x).take_while(|x| *x < 150).collect();
let b2: RoaringBitmap = (1..).into_iter().map(|x| 5 * x).take_while(|x| *x < 150).collect(); let b2: RoaringBitmap = (1..).map(|x| 5 * x).take_while(|x| *x < 150).collect();
let b3: RoaringBitmap = (1..).into_iter().map(|x| 7 * x).take_while(|x| *x < 150).collect(); let b3: RoaringBitmap = (1..).map(|x| 7 * x).take_while(|x| *x < 150).collect();
let parts_candidates = vec![b0, b1, b2, b3]; let parts_candidates = vec![b0, b1, b2, b3];
@ -632,11 +632,11 @@ mod tests {
#[test] #[test]
fn compute_combinations_4_with_some_equal_bitmaps() { fn compute_combinations_4_with_some_equal_bitmaps() {
let b0: RoaringBitmap = (0..).into_iter().map(|x| 2 * x).take_while(|x| *x < 150).collect(); let b0: RoaringBitmap = (0..).map(|x| 2 * x).take_while(|x| *x < 150).collect();
let b1: RoaringBitmap = (0..).into_iter().map(|x| 3 * x).take_while(|x| *x < 150).collect(); let b1: RoaringBitmap = (0..).map(|x| 3 * x).take_while(|x| *x < 150).collect();
let b2: RoaringBitmap = (0..).into_iter().map(|x| 5 * x).take_while(|x| *x < 150).collect(); let b2: RoaringBitmap = (0..).map(|x| 5 * x).take_while(|x| *x < 150).collect();
// b3 == b1 // b3 == b1
let b3: RoaringBitmap = (0..).into_iter().map(|x| 3 * x).take_while(|x| *x < 150).collect(); let b3: RoaringBitmap = (0..).map(|x| 3 * x).take_while(|x| *x < 150).collect();
let parts_candidates = vec![b0, b1, b2, b3]; let parts_candidates = vec![b0, b1, b2, b3];
@ -658,9 +658,7 @@ mod tests {
let dividers = [2, 3, 5, 7, 11, 6, 15, 35, 18, 14]; let dividers = [2, 3, 5, 7, 11, 6, 15, 35, 18, 14];
let parts_candidates: Vec<RoaringBitmap> = dividers let parts_candidates: Vec<RoaringBitmap> = dividers
.iter() .iter()
.map(|&divider| { .map(|&divider| (0..).map(|x| divider * x).take_while(|x| *x <= 210).collect())
(0..).into_iter().map(|x| divider * x).take_while(|x| *x <= 210).collect()
})
.collect(); .collect();
let combinations = create_disjoint_combinations(parts_candidates); let combinations = create_disjoint_combinations(parts_candidates);
@ -688,9 +686,7 @@ mod tests {
]; ];
let parts_candidates: Vec<RoaringBitmap> = dividers let parts_candidates: Vec<RoaringBitmap> = dividers
.iter() .iter()
.map(|divider| { .map(|divider| (0..).map(|x| divider * x).take_while(|x| *x <= 100).collect())
(0..).into_iter().map(|x| divider * x).take_while(|x| *x <= 100).collect()
})
.collect(); .collect();
let combinations = create_non_disjoint_combinations(parts_candidates.clone()); let combinations = create_non_disjoint_combinations(parts_candidates.clone());

View File

@ -505,7 +505,7 @@ mod tests {
let map = FacetDistribution::new(&txn, &index) let map = FacetDistribution::new(&txn, &index)
.facets(std::iter::once("colour")) .facets(std::iter::once("colour"))
.candidates((0..10_000).into_iter().collect()) .candidates((0..10_000).collect())
.execute() .execute()
.unwrap(); .unwrap();
@ -513,7 +513,7 @@ mod tests {
let map = FacetDistribution::new(&txn, &index) let map = FacetDistribution::new(&txn, &index)
.facets(std::iter::once("colour")) .facets(std::iter::once("colour"))
.candidates((0..5_000).into_iter().collect()) .candidates((0..5_000).collect())
.execute() .execute()
.unwrap(); .unwrap();
@ -521,7 +521,7 @@ mod tests {
let map = FacetDistribution::new(&txn, &index) let map = FacetDistribution::new(&txn, &index)
.facets(std::iter::once("colour")) .facets(std::iter::once("colour"))
.candidates((0..5_000).into_iter().collect()) .candidates((0..5_000).collect())
.execute() .execute()
.unwrap(); .unwrap();
@ -529,7 +529,7 @@ mod tests {
let map = FacetDistribution::new(&txn, &index) let map = FacetDistribution::new(&txn, &index)
.facets(std::iter::once("colour")) .facets(std::iter::once("colour"))
.candidates((0..5_000).into_iter().collect()) .candidates((0..5_000).collect())
.max_values_per_facet(1) .max_values_per_facet(1)
.execute() .execute()
.unwrap(); .unwrap();
@ -546,7 +546,7 @@ mod tests {
.update_settings(|settings| settings.set_filterable_fields(hashset! { S("colour") })) .update_settings(|settings| settings.set_filterable_fields(hashset! { S("colour") }))
.unwrap(); .unwrap();
let facet_values = (0..1000).into_iter().map(|x| format!("{x:x}")).collect::<Vec<_>>(); let facet_values = (0..1000).map(|x| format!("{x:x}")).collect::<Vec<_>>();
let mut documents = vec![]; let mut documents = vec![];
for i in 0..10_000 { for i in 0..10_000 {
@ -582,7 +582,7 @@ mod tests {
let map = FacetDistribution::new(&txn, &index) let map = FacetDistribution::new(&txn, &index)
.facets(std::iter::once("colour")) .facets(std::iter::once("colour"))
.candidates((0..10_000).into_iter().collect()) .candidates((0..10_000).collect())
.execute() .execute()
.unwrap(); .unwrap();
@ -590,7 +590,7 @@ mod tests {
let map = FacetDistribution::new(&txn, &index) let map = FacetDistribution::new(&txn, &index)
.facets(std::iter::once("colour")) .facets(std::iter::once("colour"))
.candidates((0..5_000).into_iter().collect()) .candidates((0..5_000).collect())
.execute() .execute()
.unwrap(); .unwrap();
@ -606,7 +606,7 @@ mod tests {
.update_settings(|settings| settings.set_filterable_fields(hashset! { S("colour") })) .update_settings(|settings| settings.set_filterable_fields(hashset! { S("colour") }))
.unwrap(); .unwrap();
let facet_values = (0..1000).into_iter().collect::<Vec<_>>(); let facet_values = (0..1000).collect::<Vec<_>>();
let mut documents = vec![]; let mut documents = vec![];
for i in 0..1000 { for i in 0..1000 {
@ -634,7 +634,7 @@ mod tests {
let map = FacetDistribution::new(&txn, &index) let map = FacetDistribution::new(&txn, &index)
.facets(std::iter::once("colour")) .facets(std::iter::once("colour"))
.candidates((0..1000).into_iter().collect()) .candidates((0..1000).collect())
.compute_stats() .compute_stats()
.unwrap(); .unwrap();
@ -642,7 +642,7 @@ mod tests {
let map = FacetDistribution::new(&txn, &index) let map = FacetDistribution::new(&txn, &index)
.facets(std::iter::once("colour")) .facets(std::iter::once("colour"))
.candidates((217..777).into_iter().collect()) .candidates((217..777).collect())
.compute_stats() .compute_stats()
.unwrap(); .unwrap();
@ -658,7 +658,7 @@ mod tests {
.update_settings(|settings| settings.set_filterable_fields(hashset! { S("colour") })) .update_settings(|settings| settings.set_filterable_fields(hashset! { S("colour") }))
.unwrap(); .unwrap();
let facet_values = (0..1000).into_iter().collect::<Vec<_>>(); let facet_values = (0..1000).collect::<Vec<_>>();
let mut documents = vec![]; let mut documents = vec![];
for i in 0..1000 { for i in 0..1000 {
@ -686,7 +686,7 @@ mod tests {
let map = FacetDistribution::new(&txn, &index) let map = FacetDistribution::new(&txn, &index)
.facets(std::iter::once("colour")) .facets(std::iter::once("colour"))
.candidates((0..1000).into_iter().collect()) .candidates((0..1000).collect())
.compute_stats() .compute_stats()
.unwrap(); .unwrap();
@ -694,7 +694,7 @@ mod tests {
let map = FacetDistribution::new(&txn, &index) let map = FacetDistribution::new(&txn, &index)
.facets(std::iter::once("colour")) .facets(std::iter::once("colour"))
.candidates((217..777).into_iter().collect()) .candidates((217..777).collect())
.compute_stats() .compute_stats()
.unwrap(); .unwrap();
@ -710,7 +710,7 @@ mod tests {
.update_settings(|settings| settings.set_filterable_fields(hashset! { S("colour") })) .update_settings(|settings| settings.set_filterable_fields(hashset! { S("colour") }))
.unwrap(); .unwrap();
let facet_values = (0..1000).into_iter().collect::<Vec<_>>(); let facet_values = (0..1000).collect::<Vec<_>>();
let mut documents = vec![]; let mut documents = vec![];
for i in 0..1000 { for i in 0..1000 {
@ -738,7 +738,7 @@ mod tests {
let map = FacetDistribution::new(&txn, &index) let map = FacetDistribution::new(&txn, &index)
.facets(std::iter::once("colour")) .facets(std::iter::once("colour"))
.candidates((0..1000).into_iter().collect()) .candidates((0..1000).collect())
.compute_stats() .compute_stats()
.unwrap(); .unwrap();
@ -746,7 +746,7 @@ mod tests {
let map = FacetDistribution::new(&txn, &index) let map = FacetDistribution::new(&txn, &index)
.facets(std::iter::once("colour")) .facets(std::iter::once("colour"))
.candidates((217..777).into_iter().collect()) .candidates((217..777).collect())
.compute_stats() .compute_stats()
.unwrap(); .unwrap();
@ -762,7 +762,7 @@ mod tests {
.update_settings(|settings| settings.set_filterable_fields(hashset! { S("colour") })) .update_settings(|settings| settings.set_filterable_fields(hashset! { S("colour") }))
.unwrap(); .unwrap();
let facet_values = (0..1000).into_iter().collect::<Vec<_>>(); let facet_values = (0..1000).collect::<Vec<_>>();
let mut documents = vec![]; let mut documents = vec![];
for i in 0..1000 { for i in 0..1000 {
@ -794,7 +794,7 @@ mod tests {
let map = FacetDistribution::new(&txn, &index) let map = FacetDistribution::new(&txn, &index)
.facets(std::iter::once("colour")) .facets(std::iter::once("colour"))
.candidates((0..1000).into_iter().collect()) .candidates((0..1000).collect())
.compute_stats() .compute_stats()
.unwrap(); .unwrap();
@ -802,7 +802,7 @@ mod tests {
let map = FacetDistribution::new(&txn, &index) let map = FacetDistribution::new(&txn, &index)
.facets(std::iter::once("colour")) .facets(std::iter::once("colour"))
.candidates((217..777).into_iter().collect()) .candidates((217..777).collect())
.compute_stats() .compute_stats()
.unwrap(); .unwrap();

View File

@ -142,7 +142,7 @@ mod tests {
let indexes = [get_simple_index(), get_random_looking_index()]; let indexes = [get_simple_index(), get_random_looking_index()];
for (i, index) in indexes.iter().enumerate() { for (i, index) in indexes.iter().enumerate() {
let txn = index.env.read_txn().unwrap(); let txn = index.env.read_txn().unwrap();
let candidates = (0..=255).into_iter().collect::<RoaringBitmap>(); let candidates = (0..=255).collect::<RoaringBitmap>();
let mut results = String::new(); let mut results = String::new();
iterate_over_facet_distribution( iterate_over_facet_distribution(
&txn, &txn,
@ -166,7 +166,7 @@ mod tests {
let indexes = [get_simple_index(), get_random_looking_index()]; let indexes = [get_simple_index(), get_random_looking_index()];
for (i, index) in indexes.iter().enumerate() { for (i, index) in indexes.iter().enumerate() {
let txn = index.env.read_txn().unwrap(); let txn = index.env.read_txn().unwrap();
let candidates = (0..=255).into_iter().collect::<RoaringBitmap>(); let candidates = (0..=255).collect::<RoaringBitmap>();
let mut results = String::new(); let mut results = String::new();
let mut nbr_facets = 0; let mut nbr_facets = 0;
iterate_over_facet_distribution( iterate_over_facet_distribution(

View File

@ -410,7 +410,7 @@ mod tests {
let mut results = String::new(); let mut results = String::new();
for i in (0..=255).into_iter().rev() { for i in (0..=255).rev() {
let i = i as f64; let i = i as f64;
let start = Bound::Included(i); let start = Bound::Included(i);
let end = Bound::Included(255.); let end = Bound::Included(255.);
@ -431,7 +431,7 @@ mod tests {
let mut results = String::new(); let mut results = String::new();
for i in (0..=255).into_iter().rev() { for i in (0..=255).rev() {
let i = i as f64; let i = i as f64;
let start = Bound::Excluded(i); let start = Bound::Excluded(i);
let end = Bound::Excluded(255.); let end = Bound::Excluded(255.);
@ -466,7 +466,7 @@ mod tests {
let mut results = String::new(); let mut results = String::new();
for i in (0..=128).into_iter().rev() { for i in (0..=128).rev() {
let i = i as f64; let i = i as f64;
let start = Bound::Included(i); let start = Bound::Included(i);
let end = Bound::Included(255. - i); let end = Bound::Included(255. - i);
@ -491,7 +491,7 @@ mod tests {
let mut results = String::new(); let mut results = String::new();
for i in (0..=128).into_iter().rev() { for i in (0..=128).rev() {
let i = i as f64; let i = i as f64;
let start = Bound::Excluded(i); let start = Bound::Excluded(i);
let end = Bound::Excluded(255. - i); let end = Bound::Excluded(255. - i);

View File

@ -132,7 +132,7 @@ mod tests {
let indexes = [get_simple_index(), get_random_looking_index()]; let indexes = [get_simple_index(), get_random_looking_index()];
for (i, index) in indexes.iter().enumerate() { for (i, index) in indexes.iter().enumerate() {
let txn = index.env.read_txn().unwrap(); let txn = index.env.read_txn().unwrap();
let candidates = (200..=300).into_iter().collect::<RoaringBitmap>(); let candidates = (200..=300).collect::<RoaringBitmap>();
let mut results = String::new(); let mut results = String::new();
let iter = ascending_facet_sort(&txn, index.content, 0, candidates).unwrap(); let iter = ascending_facet_sort(&txn, index.content, 0, candidates).unwrap();
for el in iter { for el in iter {
@ -154,7 +154,7 @@ mod tests {
]; ];
for (i, index) in indexes.iter().enumerate() { for (i, index) in indexes.iter().enumerate() {
let txn = index.env.read_txn().unwrap(); let txn = index.env.read_txn().unwrap();
let candidates = (200..=300).into_iter().collect::<RoaringBitmap>(); let candidates = (200..=300).collect::<RoaringBitmap>();
let mut results = String::new(); let mut results = String::new();
let iter = ascending_facet_sort(&txn, index.content, 0, candidates.clone()).unwrap(); let iter = ascending_facet_sort(&txn, index.content, 0, candidates.clone()).unwrap();
for el in iter { for el in iter {

View File

@ -142,7 +142,7 @@ mod tests {
]; ];
for (i, index) in indexes.iter().enumerate() { for (i, index) in indexes.iter().enumerate() {
let txn = index.env.read_txn().unwrap(); let txn = index.env.read_txn().unwrap();
let candidates = (200..=300).into_iter().collect::<RoaringBitmap>(); let candidates = (200..=300).collect::<RoaringBitmap>();
let mut results = String::new(); let mut results = String::new();
let db = index.content.remap_key_type::<FacetGroupKeyCodec<ByteSliceRefCodec>>(); let db = index.content.remap_key_type::<FacetGroupKeyCodec<ByteSliceRefCodec>>();
let iter = descending_facet_sort(&txn, db, 0, candidates).unwrap(); let iter = descending_facet_sort(&txn, db, 0, candidates).unwrap();
@ -165,7 +165,7 @@ mod tests {
]; ];
for (i, index) in indexes.iter().enumerate() { for (i, index) in indexes.iter().enumerate() {
let txn = index.env.read_txn().unwrap(); let txn = index.env.read_txn().unwrap();
let candidates = (200..=300).into_iter().collect::<RoaringBitmap>(); let candidates = (200..=300).collect::<RoaringBitmap>();
let mut results = String::new(); let mut results = String::new();
let db = index.content.remap_key_type::<FacetGroupKeyCodec<ByteSliceRefCodec>>(); let db = index.content.remap_key_type::<FacetGroupKeyCodec<ByteSliceRefCodec>>();
let iter = descending_facet_sort(&txn, db, 0, candidates.clone()).unwrap(); let iter = descending_facet_sort(&txn, db, 0, candidates.clone()).unwrap();

View File

@ -628,8 +628,7 @@ fn create_matching_words(
} }
// create a CONSECUTIVE matchings words wrapping all word in the phrase // create a CONSECUTIVE matchings words wrapping all word in the phrase
PrimitiveQueryPart::Phrase(words) => { PrimitiveQueryPart::Phrase(words) => {
let ids: Vec<_> = let ids: Vec<_> = (0..words.len()).map(|i| id + i as PrimitiveWordId).collect();
(0..words.len()).into_iter().map(|i| id + i as PrimitiveWordId).collect();
// Require that all words of the phrase have a corresponding MatchingWord // Require that all words of the phrase have a corresponding MatchingWord
// before adding any of them to the matching_words result // before adding any of them to the matching_words result
if let Some(phrase_matching_words) = words if let Some(phrase_matching_words) = words
@ -686,10 +685,8 @@ fn create_matching_words(
} }
}) })
.collect(); .collect();
let ids: Vec<_> = (0..words.len()) let ids: Vec<_> =
.into_iter() (0..words.len()).map(|i| id + i as PrimitiveWordId).collect();
.map(|i| id + i as PrimitiveWordId)
.collect();
if let Some(synonyms) = ctx.synonyms(&words)? { if let Some(synonyms) = ctx.synonyms(&words)? {
for synonym in synonyms { for synonym in synonyms {

View File

@ -699,21 +699,21 @@ mod tests {
#[test] #[test]
fn many_field_ids_prepend() { fn many_field_ids_prepend() {
let index = FacetIndex::<OrderedF64Codec>::new(4, 8, 5); let index = FacetIndex::<OrderedF64Codec>::new(4, 8, 5);
for i in (0..256).into_iter().rev() { for i in (0..256).rev() {
let mut bitmap = RoaringBitmap::new(); let mut bitmap = RoaringBitmap::new();
bitmap.insert(i as u32); bitmap.insert(i as u32);
let mut txn = index.env.write_txn().unwrap(); let mut txn = index.env.write_txn().unwrap();
index.insert(&mut txn, 0, &(i as f64), &bitmap); index.insert(&mut txn, 0, &(i as f64), &bitmap);
txn.commit().unwrap(); txn.commit().unwrap();
} }
for i in (0..256).into_iter().rev() { for i in (0..256).rev() {
let mut bitmap = RoaringBitmap::new(); let mut bitmap = RoaringBitmap::new();
bitmap.insert(i as u32); bitmap.insert(i as u32);
let mut txn = index.env.write_txn().unwrap(); let mut txn = index.env.write_txn().unwrap();
index.insert(&mut txn, 2, &(i as f64), &bitmap); index.insert(&mut txn, 2, &(i as f64), &bitmap);
txn.commit().unwrap(); txn.commit().unwrap();
} }
for i in (0..256).into_iter().rev() { for i in (0..256).rev() {
let mut bitmap = RoaringBitmap::new(); let mut bitmap = RoaringBitmap::new();
bitmap.insert(i as u32); bitmap.insert(i as u32);
let mut txn = index.env.write_txn().unwrap(); let mut txn = index.env.write_txn().unwrap();
@ -733,7 +733,7 @@ mod tests {
let index = FacetIndex::<OrderedF64Codec>::new(4, 8, 5); let index = FacetIndex::<OrderedF64Codec>::new(4, 8, 5);
let mut txn = index.env.write_txn().unwrap(); let mut txn = index.env.write_txn().unwrap();
for i in (0..256).into_iter().rev() { for i in (0..256).rev() {
let mut bitmap = RoaringBitmap::new(); let mut bitmap = RoaringBitmap::new();
bitmap.insert(i); bitmap.insert(i);
index.insert(&mut txn, 0, &(i as f64), &bitmap); index.insert(&mut txn, 0, &(i as f64), &bitmap);
@ -749,7 +749,7 @@ mod tests {
let index = FacetIndex::<OrderedF64Codec>::new(4, 8, 5); let index = FacetIndex::<OrderedF64Codec>::new(4, 8, 5);
let mut txn = index.env.write_txn().unwrap(); let mut txn = index.env.write_txn().unwrap();
let mut keys = (0..256).into_iter().collect::<Vec<_>>(); let mut keys = (0..256).collect::<Vec<_>>();
let mut rng = rand::rngs::SmallRng::from_seed([0; 32]); let mut rng = rand::rngs::SmallRng::from_seed([0; 32]);
keys.shuffle(&mut rng); keys.shuffle(&mut rng);
@ -768,7 +768,7 @@ mod tests {
let index = FacetIndex::<OrderedF64Codec>::new(4, 8, 5); let index = FacetIndex::<OrderedF64Codec>::new(4, 8, 5);
let mut txn = index.env.write_txn().unwrap(); let mut txn = index.env.write_txn().unwrap();
let mut keys = (0..256).into_iter().collect::<Vec<_>>(); let mut keys = (0..256).collect::<Vec<_>>();
let mut rng = rand::rngs::SmallRng::from_seed([0; 32]); let mut rng = rand::rngs::SmallRng::from_seed([0; 32]);
keys.shuffle(&mut rng); keys.shuffle(&mut rng);
@ -796,7 +796,7 @@ mod tests {
index.insert(&mut txn, 0, &(i as f64), &bitmap); index.insert(&mut txn, 0, &(i as f64), &bitmap);
} }
for i in (200..256).into_iter().rev() { for i in (200..256).rev() {
index.verify_structure_validity(&txn, 0); index.verify_structure_validity(&txn, 0);
index.delete_single_docid(&mut txn, 0, &(i as f64), i as u32); index.delete_single_docid(&mut txn, 0, &(i as f64), i as u32);
} }
@ -805,7 +805,7 @@ mod tests {
milli_snap!(format!("{index}"), 200); milli_snap!(format!("{index}"), 200);
let mut txn = index.env.write_txn().unwrap(); let mut txn = index.env.write_txn().unwrap();
for i in (150..200).into_iter().rev() { for i in (150..200).rev() {
index.verify_structure_validity(&txn, 0); index.verify_structure_validity(&txn, 0);
index.delete_single_docid(&mut txn, 0, &(i as f64), i as u32); index.delete_single_docid(&mut txn, 0, &(i as f64), i as u32);
} }
@ -813,7 +813,7 @@ mod tests {
txn.commit().unwrap(); txn.commit().unwrap();
milli_snap!(format!("{index}"), 150); milli_snap!(format!("{index}"), 150);
let mut txn = index.env.write_txn().unwrap(); let mut txn = index.env.write_txn().unwrap();
for i in (100..150).into_iter().rev() { for i in (100..150).rev() {
index.verify_structure_validity(&txn, 0); index.verify_structure_validity(&txn, 0);
index.delete_single_docid(&mut txn, 0, &(i as f64), i as u32); index.delete_single_docid(&mut txn, 0, &(i as f64), i as u32);
} }
@ -821,7 +821,7 @@ mod tests {
txn.commit().unwrap(); txn.commit().unwrap();
milli_snap!(format!("{index}"), 100); milli_snap!(format!("{index}"), 100);
let mut txn = index.env.write_txn().unwrap(); let mut txn = index.env.write_txn().unwrap();
for i in (17..100).into_iter().rev() { for i in (17..100).rev() {
index.verify_structure_validity(&txn, 0); index.verify_structure_validity(&txn, 0);
index.delete_single_docid(&mut txn, 0, &(i as f64), i as u32); index.delete_single_docid(&mut txn, 0, &(i as f64), i as u32);
} }
@ -829,14 +829,14 @@ mod tests {
txn.commit().unwrap(); txn.commit().unwrap();
milli_snap!(format!("{index}"), 17); milli_snap!(format!("{index}"), 17);
let mut txn = index.env.write_txn().unwrap(); let mut txn = index.env.write_txn().unwrap();
for i in (15..17).into_iter().rev() { for i in (15..17).rev() {
index.delete_single_docid(&mut txn, 0, &(i as f64), i as u32); index.delete_single_docid(&mut txn, 0, &(i as f64), i as u32);
} }
index.verify_structure_validity(&txn, 0); index.verify_structure_validity(&txn, 0);
txn.commit().unwrap(); txn.commit().unwrap();
milli_snap!(format!("{index}"), 15); milli_snap!(format!("{index}"), 15);
let mut txn = index.env.write_txn().unwrap(); let mut txn = index.env.write_txn().unwrap();
for i in (0..15).into_iter().rev() { for i in (0..15).rev() {
index.verify_structure_validity(&txn, 0); index.verify_structure_validity(&txn, 0);
index.delete_single_docid(&mut txn, 0, &(i as f64), i as u32); index.delete_single_docid(&mut txn, 0, &(i as f64), i as u32);
} }
@ -893,7 +893,7 @@ mod tests {
index.insert(&mut txn, 0, &(i as f64), &bitmap); index.insert(&mut txn, 0, &(i as f64), &bitmap);
} }
let mut keys = (0..256).into_iter().collect::<Vec<_>>(); let mut keys = (0..256).collect::<Vec<_>>();
let mut rng = rand::rngs::SmallRng::from_seed([0; 32]); let mut rng = rand::rngs::SmallRng::from_seed([0; 32]);
keys.shuffle(&mut rng); keys.shuffle(&mut rng);
@ -930,7 +930,7 @@ mod tests {
let index = FacetIndex::<OrderedF64Codec>::new(4, 8, 5); let index = FacetIndex::<OrderedF64Codec>::new(4, 8, 5);
let mut txn = index.env.write_txn().unwrap(); let mut txn = index.env.write_txn().unwrap();
let mut keys = (0..16).into_iter().collect::<Vec<_>>(); let mut keys = (0..16).collect::<Vec<_>>();
let mut rng = rand::rngs::SmallRng::from_seed([0; 32]); let mut rng = rand::rngs::SmallRng::from_seed([0; 32]);
keys.shuffle(&mut rng); keys.shuffle(&mut rng);
for i in 0..4 { for i in 0..4 {
@ -951,7 +951,7 @@ mod tests {
let index = FacetIndex::<OrderedF64Codec>::new(4, 8, 5); let index = FacetIndex::<OrderedF64Codec>::new(4, 8, 5);
let mut txn = index.env.write_txn().unwrap(); let mut txn = index.env.write_txn().unwrap();
let mut keys = (0..64).into_iter().collect::<Vec<_>>(); let mut keys = (0..64).collect::<Vec<_>>();
let mut rng = rand::rngs::SmallRng::from_seed([0; 32]); let mut rng = rand::rngs::SmallRng::from_seed([0; 32]);
keys.shuffle(&mut rng); keys.shuffle(&mut rng);
@ -983,7 +983,7 @@ mod tests {
let index = FacetIndex::<StrRefCodec>::new(4, 8, 5); let index = FacetIndex::<StrRefCodec>::new(4, 8, 5);
let mut txn = index.env.write_txn().unwrap(); let mut txn = index.env.write_txn().unwrap();
let mut keys = (1000..1064).into_iter().collect::<Vec<_>>(); let mut keys = (1000..1064).collect::<Vec<_>>();
let mut rng = rand::rngs::SmallRng::from_seed([0; 32]); let mut rng = rand::rngs::SmallRng::from_seed([0; 32]);
keys.shuffle(&mut rng); keys.shuffle(&mut rng);

View File

@ -1613,7 +1613,6 @@ mod tests {
// Create 200 documents with a long text // Create 200 documents with a long text
let content = { let content = {
let documents_iter = (0..200i32) let documents_iter = (0..200i32)
.into_iter()
.map(|i| serde_json::json!({ "id": i, "script": script })) .map(|i| serde_json::json!({ "id": i, "script": script }))
.filter_map(|json| match json { .filter_map(|json| match json {
serde_json::Value::Object(object) => Some(object), serde_json::Value::Object(object) => Some(object),