From e0730b55b30f5d5b75900a64a14e36503b06cb7c Mon Sep 17 00:00:00 2001 From: curquiza Date: Tue, 25 Apr 2023 16:05:28 +0200 Subject: [PATCH 1/3] Update clippy toolchain from v1.67 to v1.69 --- .github/workflows/test-suite.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index 820fcb656..46e1e87dc 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -138,7 +138,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.67.0 + toolchain: 1.69.0 override: true components: clippy - name: Cache dependencies From cfd1b2cc97a2fece6c893da2af2455e881ab09ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Tue, 25 Apr 2023 16:40:32 +0200 Subject: [PATCH 2/3] Fix the clippy warnings --- dump/src/reader/compat/v2_to_v3.rs | 1 - meilisearch/tests/documents/add_documents.rs | 3 +- milli/src/search/criteria/exactness.rs | 34 ++++++++--------- milli/src/search/facet/facet_distribution.rs | 38 +++++++++---------- .../search/facet/facet_distribution_iter.rs | 4 +- milli/src/search/facet/facet_range_search.rs | 8 ++-- .../src/search/facet/facet_sort_ascending.rs | 4 +- .../src/search/facet/facet_sort_descending.rs | 4 +- milli/src/search/query_tree.rs | 3 +- milli/src/update/facet/incremental.rs | 32 ++++++++-------- milli/src/update/index_documents/mod.rs | 1 - 11 files changed, 64 insertions(+), 68 deletions(-) diff --git a/dump/src/reader/compat/v2_to_v3.rs b/dump/src/reader/compat/v2_to_v3.rs index 14fc0ee4d..1d5f4e153 100644 --- a/dump/src/reader/compat/v2_to_v3.rs +++ b/dump/src/reader/compat/v2_to_v3.rs @@ -25,7 +25,6 @@ impl CompatV2ToV3 { CompatV2ToV3::Compat(compat) => compat.index_uuid(), }; v2_uuids - .into_iter() .into_iter() .map(|index| v3::meta::IndexUuid { uid: index.uid, uuid: index.uuid }) .collect() diff --git a/meilisearch/tests/documents/add_documents.rs b/meilisearch/tests/documents/add_documents.rs index 164d68582..c2ba2ccaa 100644 --- a/meilisearch/tests/documents/add_documents.rs +++ b/meilisearch/tests/documents/add_documents.rs @@ -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" } ); - 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 (response, code) = index.add_documents(documents, None).await; @@ -1934,7 +1934,6 @@ async fn batch_several_documents_addition() { let index = server.index("test"); let mut documents: Vec<_> = (0..150usize) - .into_iter() .map(|id| { json!( { diff --git a/milli/src/search/criteria/exactness.rs b/milli/src/search/criteria/exactness.rs index 078a9cd6c..6ca5735b7 100644 --- a/milli/src/search/criteria/exactness.rs +++ b/milli/src/search/criteria/exactness.rs @@ -561,7 +561,7 @@ mod tests { #[test] 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]; @@ -575,8 +575,8 @@ mod tests { #[test] fn compute_combinations_2() { - let b0: RoaringBitmap = (0..).into_iter().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 b0: RoaringBitmap = (0..).map(|x| 2 * 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]; @@ -589,10 +589,10 @@ mod tests { #[test] fn compute_combinations_4() { - let b0: RoaringBitmap = (0..).into_iter().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 b2: RoaringBitmap = (0..).into_iter().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 b0: RoaringBitmap = (0..).map(|x| 2 * 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..).map(|x| 5 * 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]; @@ -610,10 +610,10 @@ mod tests { } #[test] 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 b1: RoaringBitmap = (1..).into_iter().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 b3: RoaringBitmap = (1..).into_iter().map(|x| 7 * 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..).map(|x| 3 * 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..).map(|x| 7 * x).take_while(|x| *x < 150).collect(); let parts_candidates = vec![b0, b1, b2, b3]; @@ -632,11 +632,11 @@ mod tests { #[test] 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 b1: RoaringBitmap = (0..).into_iter().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 b0: RoaringBitmap = (0..).map(|x| 2 * 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..).map(|x| 5 * x).take_while(|x| *x < 150).collect(); // 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]; @@ -659,7 +659,7 @@ mod tests { let parts_candidates: Vec = dividers .iter() .map(|÷r| { - (0..).into_iter().map(|x| divider * x).take_while(|x| *x <= 210).collect() + (0..).map(|x| divider * x).take_while(|x| *x <= 210).collect() }) .collect(); @@ -689,7 +689,7 @@ mod tests { let parts_candidates: Vec = dividers .iter() .map(|divider| { - (0..).into_iter().map(|x| divider * x).take_while(|x| *x <= 100).collect() + (0..).map(|x| divider * x).take_while(|x| *x <= 100).collect() }) .collect(); diff --git a/milli/src/search/facet/facet_distribution.rs b/milli/src/search/facet/facet_distribution.rs index 2aae78bb2..d2a026165 100644 --- a/milli/src/search/facet/facet_distribution.rs +++ b/milli/src/search/facet/facet_distribution.rs @@ -505,7 +505,7 @@ mod tests { let map = FacetDistribution::new(&txn, &index) .facets(std::iter::once("colour")) - .candidates((0..10_000).into_iter().collect()) + .candidates((0..10_000).collect()) .execute() .unwrap(); @@ -513,7 +513,7 @@ mod tests { let map = FacetDistribution::new(&txn, &index) .facets(std::iter::once("colour")) - .candidates((0..5_000).into_iter().collect()) + .candidates((0..5_000).collect()) .execute() .unwrap(); @@ -521,7 +521,7 @@ mod tests { let map = FacetDistribution::new(&txn, &index) .facets(std::iter::once("colour")) - .candidates((0..5_000).into_iter().collect()) + .candidates((0..5_000).collect()) .execute() .unwrap(); @@ -529,7 +529,7 @@ mod tests { let map = FacetDistribution::new(&txn, &index) .facets(std::iter::once("colour")) - .candidates((0..5_000).into_iter().collect()) + .candidates((0..5_000).collect()) .max_values_per_facet(1) .execute() .unwrap(); @@ -546,7 +546,7 @@ mod tests { .update_settings(|settings| settings.set_filterable_fields(hashset! { S("colour") })) .unwrap(); - let facet_values = (0..1000).into_iter().map(|x| format!("{x:x}")).collect::>(); + let facet_values = (0..1000).map(|x| format!("{x:x}")).collect::>(); let mut documents = vec![]; for i in 0..10_000 { @@ -582,7 +582,7 @@ mod tests { let map = FacetDistribution::new(&txn, &index) .facets(std::iter::once("colour")) - .candidates((0..10_000).into_iter().collect()) + .candidates((0..10_000).collect()) .execute() .unwrap(); @@ -590,7 +590,7 @@ mod tests { let map = FacetDistribution::new(&txn, &index) .facets(std::iter::once("colour")) - .candidates((0..5_000).into_iter().collect()) + .candidates((0..5_000).collect()) .execute() .unwrap(); @@ -606,7 +606,7 @@ mod tests { .update_settings(|settings| settings.set_filterable_fields(hashset! { S("colour") })) .unwrap(); - let facet_values = (0..1000).into_iter().collect::>(); + let facet_values = (0..1000).collect::>(); let mut documents = vec![]; for i in 0..1000 { @@ -634,7 +634,7 @@ mod tests { let map = FacetDistribution::new(&txn, &index) .facets(std::iter::once("colour")) - .candidates((0..1000).into_iter().collect()) + .candidates((0..1000).collect()) .compute_stats() .unwrap(); @@ -642,7 +642,7 @@ mod tests { let map = FacetDistribution::new(&txn, &index) .facets(std::iter::once("colour")) - .candidates((217..777).into_iter().collect()) + .candidates((217..777).collect()) .compute_stats() .unwrap(); @@ -658,7 +658,7 @@ mod tests { .update_settings(|settings| settings.set_filterable_fields(hashset! { S("colour") })) .unwrap(); - let facet_values = (0..1000).into_iter().collect::>(); + let facet_values = (0..1000).collect::>(); let mut documents = vec![]; for i in 0..1000 { @@ -686,7 +686,7 @@ mod tests { let map = FacetDistribution::new(&txn, &index) .facets(std::iter::once("colour")) - .candidates((0..1000).into_iter().collect()) + .candidates((0..1000).collect()) .compute_stats() .unwrap(); @@ -694,7 +694,7 @@ mod tests { let map = FacetDistribution::new(&txn, &index) .facets(std::iter::once("colour")) - .candidates((217..777).into_iter().collect()) + .candidates((217..777).collect()) .compute_stats() .unwrap(); @@ -710,7 +710,7 @@ mod tests { .update_settings(|settings| settings.set_filterable_fields(hashset! { S("colour") })) .unwrap(); - let facet_values = (0..1000).into_iter().collect::>(); + let facet_values = (0..1000).collect::>(); let mut documents = vec![]; for i in 0..1000 { @@ -738,7 +738,7 @@ mod tests { let map = FacetDistribution::new(&txn, &index) .facets(std::iter::once("colour")) - .candidates((0..1000).into_iter().collect()) + .candidates((0..1000).collect()) .compute_stats() .unwrap(); @@ -746,7 +746,7 @@ mod tests { let map = FacetDistribution::new(&txn, &index) .facets(std::iter::once("colour")) - .candidates((217..777).into_iter().collect()) + .candidates((217..777).collect()) .compute_stats() .unwrap(); @@ -762,7 +762,7 @@ mod tests { .update_settings(|settings| settings.set_filterable_fields(hashset! { S("colour") })) .unwrap(); - let facet_values = (0..1000).into_iter().collect::>(); + let facet_values = (0..1000).collect::>(); let mut documents = vec![]; for i in 0..1000 { @@ -794,7 +794,7 @@ mod tests { let map = FacetDistribution::new(&txn, &index) .facets(std::iter::once("colour")) - .candidates((0..1000).into_iter().collect()) + .candidates((0..1000).collect()) .compute_stats() .unwrap(); @@ -802,7 +802,7 @@ mod tests { let map = FacetDistribution::new(&txn, &index) .facets(std::iter::once("colour")) - .candidates((217..777).into_iter().collect()) + .candidates((217..777).collect()) .compute_stats() .unwrap(); diff --git a/milli/src/search/facet/facet_distribution_iter.rs b/milli/src/search/facet/facet_distribution_iter.rs index bb3c75343..d355b981a 100644 --- a/milli/src/search/facet/facet_distribution_iter.rs +++ b/milli/src/search/facet/facet_distribution_iter.rs @@ -142,7 +142,7 @@ mod tests { let indexes = [get_simple_index(), get_random_looking_index()]; for (i, index) in indexes.iter().enumerate() { let txn = index.env.read_txn().unwrap(); - let candidates = (0..=255).into_iter().collect::(); + let candidates = (0..=255).collect::(); let mut results = String::new(); iterate_over_facet_distribution( &txn, @@ -166,7 +166,7 @@ mod tests { let indexes = [get_simple_index(), get_random_looking_index()]; for (i, index) in indexes.iter().enumerate() { let txn = index.env.read_txn().unwrap(); - let candidates = (0..=255).into_iter().collect::(); + let candidates = (0..=255).collect::(); let mut results = String::new(); let mut nbr_facets = 0; iterate_over_facet_distribution( diff --git a/milli/src/search/facet/facet_range_search.rs b/milli/src/search/facet/facet_range_search.rs index b1ab6f71f..26854bc1a 100644 --- a/milli/src/search/facet/facet_range_search.rs +++ b/milli/src/search/facet/facet_range_search.rs @@ -410,7 +410,7 @@ mod tests { 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 start = Bound::Included(i); let end = Bound::Included(255.); @@ -431,7 +431,7 @@ mod tests { 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 start = Bound::Excluded(i); let end = Bound::Excluded(255.); @@ -466,7 +466,7 @@ mod tests { 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 start = Bound::Included(i); let end = Bound::Included(255. - i); @@ -491,7 +491,7 @@ mod tests { 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 start = Bound::Excluded(i); let end = Bound::Excluded(255. - i); diff --git a/milli/src/search/facet/facet_sort_ascending.rs b/milli/src/search/facet/facet_sort_ascending.rs index f59b884de..892401c08 100644 --- a/milli/src/search/facet/facet_sort_ascending.rs +++ b/milli/src/search/facet/facet_sort_ascending.rs @@ -132,7 +132,7 @@ mod tests { let indexes = [get_simple_index(), get_random_looking_index()]; for (i, index) in indexes.iter().enumerate() { let txn = index.env.read_txn().unwrap(); - let candidates = (200..=300).into_iter().collect::(); + let candidates = (200..=300).collect::(); let mut results = String::new(); let iter = ascending_facet_sort(&txn, index.content, 0, candidates).unwrap(); for el in iter { @@ -154,7 +154,7 @@ mod tests { ]; for (i, index) in indexes.iter().enumerate() { let txn = index.env.read_txn().unwrap(); - let candidates = (200..=300).into_iter().collect::(); + let candidates = (200..=300).collect::(); let mut results = String::new(); let iter = ascending_facet_sort(&txn, index.content, 0, candidates.clone()).unwrap(); for el in iter { diff --git a/milli/src/search/facet/facet_sort_descending.rs b/milli/src/search/facet/facet_sort_descending.rs index 454b12859..549f50f0a 100644 --- a/milli/src/search/facet/facet_sort_descending.rs +++ b/milli/src/search/facet/facet_sort_descending.rs @@ -142,7 +142,7 @@ mod tests { ]; for (i, index) in indexes.iter().enumerate() { let txn = index.env.read_txn().unwrap(); - let candidates = (200..=300).into_iter().collect::(); + let candidates = (200..=300).collect::(); let mut results = String::new(); let db = index.content.remap_key_type::>(); let iter = descending_facet_sort(&txn, db, 0, candidates).unwrap(); @@ -165,7 +165,7 @@ mod tests { ]; for (i, index) in indexes.iter().enumerate() { let txn = index.env.read_txn().unwrap(); - let candidates = (200..=300).into_iter().collect::(); + let candidates = (200..=300).collect::(); let mut results = String::new(); let db = index.content.remap_key_type::>(); let iter = descending_facet_sort(&txn, db, 0, candidates.clone()).unwrap(); diff --git a/milli/src/search/query_tree.rs b/milli/src/search/query_tree.rs index 50f16c2d9..15b18b565 100755 --- a/milli/src/search/query_tree.rs +++ b/milli/src/search/query_tree.rs @@ -629,7 +629,7 @@ fn create_matching_words( // create a CONSECUTIVE matchings words wrapping all word in the phrase PrimitiveQueryPart::Phrase(words) => { let ids: Vec<_> = - (0..words.len()).into_iter().map(|i| id + i as PrimitiveWordId).collect(); + (0..words.len()).map(|i| id + i as PrimitiveWordId).collect(); // Require that all words of the phrase have a corresponding MatchingWord // before adding any of them to the matching_words result if let Some(phrase_matching_words) = words @@ -687,7 +687,6 @@ fn create_matching_words( }) .collect(); let ids: Vec<_> = (0..words.len()) - .into_iter() .map(|i| id + i as PrimitiveWordId) .collect(); diff --git a/milli/src/update/facet/incremental.rs b/milli/src/update/facet/incremental.rs index aaef93b48..a921d4115 100644 --- a/milli/src/update/facet/incremental.rs +++ b/milli/src/update/facet/incremental.rs @@ -699,21 +699,21 @@ mod tests { #[test] fn many_field_ids_prepend() { let index = FacetIndex::::new(4, 8, 5); - for i in (0..256).into_iter().rev() { + for i in (0..256).rev() { let mut bitmap = RoaringBitmap::new(); bitmap.insert(i as u32); let mut txn = index.env.write_txn().unwrap(); index.insert(&mut txn, 0, &(i as f64), &bitmap); txn.commit().unwrap(); } - for i in (0..256).into_iter().rev() { + for i in (0..256).rev() { let mut bitmap = RoaringBitmap::new(); bitmap.insert(i as u32); let mut txn = index.env.write_txn().unwrap(); index.insert(&mut txn, 2, &(i as f64), &bitmap); txn.commit().unwrap(); } - for i in (0..256).into_iter().rev() { + for i in (0..256).rev() { let mut bitmap = RoaringBitmap::new(); bitmap.insert(i as u32); let mut txn = index.env.write_txn().unwrap(); @@ -733,7 +733,7 @@ mod tests { let index = FacetIndex::::new(4, 8, 5); 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(); bitmap.insert(i); index.insert(&mut txn, 0, &(i as f64), &bitmap); @@ -749,7 +749,7 @@ mod tests { let index = FacetIndex::::new(4, 8, 5); let mut txn = index.env.write_txn().unwrap(); - let mut keys = (0..256).into_iter().collect::>(); + let mut keys = (0..256).collect::>(); let mut rng = rand::rngs::SmallRng::from_seed([0; 32]); keys.shuffle(&mut rng); @@ -768,7 +768,7 @@ mod tests { let index = FacetIndex::::new(4, 8, 5); let mut txn = index.env.write_txn().unwrap(); - let mut keys = (0..256).into_iter().collect::>(); + let mut keys = (0..256).collect::>(); let mut rng = rand::rngs::SmallRng::from_seed([0; 32]); keys.shuffle(&mut rng); @@ -796,7 +796,7 @@ mod tests { 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.delete_single_docid(&mut txn, 0, &(i as f64), i as u32); } @@ -805,7 +805,7 @@ mod tests { milli_snap!(format!("{index}"), 200); 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.delete_single_docid(&mut txn, 0, &(i as f64), i as u32); } @@ -813,7 +813,7 @@ mod tests { txn.commit().unwrap(); milli_snap!(format!("{index}"), 150); 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.delete_single_docid(&mut txn, 0, &(i as f64), i as u32); } @@ -821,7 +821,7 @@ mod tests { txn.commit().unwrap(); milli_snap!(format!("{index}"), 100); 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.delete_single_docid(&mut txn, 0, &(i as f64), i as u32); } @@ -829,14 +829,14 @@ mod tests { txn.commit().unwrap(); milli_snap!(format!("{index}"), 17); 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.verify_structure_validity(&txn, 0); txn.commit().unwrap(); milli_snap!(format!("{index}"), 15); 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.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); } - let mut keys = (0..256).into_iter().collect::>(); + let mut keys = (0..256).collect::>(); let mut rng = rand::rngs::SmallRng::from_seed([0; 32]); keys.shuffle(&mut rng); @@ -930,7 +930,7 @@ mod tests { let index = FacetIndex::::new(4, 8, 5); let mut txn = index.env.write_txn().unwrap(); - let mut keys = (0..16).into_iter().collect::>(); + let mut keys = (0..16).collect::>(); let mut rng = rand::rngs::SmallRng::from_seed([0; 32]); keys.shuffle(&mut rng); for i in 0..4 { @@ -951,7 +951,7 @@ mod tests { let index = FacetIndex::::new(4, 8, 5); let mut txn = index.env.write_txn().unwrap(); - let mut keys = (0..64).into_iter().collect::>(); + let mut keys = (0..64).collect::>(); let mut rng = rand::rngs::SmallRng::from_seed([0; 32]); keys.shuffle(&mut rng); @@ -983,7 +983,7 @@ mod tests { let index = FacetIndex::::new(4, 8, 5); let mut txn = index.env.write_txn().unwrap(); - let mut keys = (1000..1064).into_iter().collect::>(); + let mut keys = (1000..1064).collect::>(); let mut rng = rand::rngs::SmallRng::from_seed([0; 32]); keys.shuffle(&mut rng); diff --git a/milli/src/update/index_documents/mod.rs b/milli/src/update/index_documents/mod.rs index 2a7930f84..ade217beb 100644 --- a/milli/src/update/index_documents/mod.rs +++ b/milli/src/update/index_documents/mod.rs @@ -1613,7 +1613,6 @@ mod tests { // Create 200 documents with a long text let content = { let documents_iter = (0..200i32) - .into_iter() .map(|i| serde_json::json!({ "id": i, "script": script })) .filter_map(|json| match json { serde_json::Value::Object(object) => Some(object), From 14293f6c8ff0d2c3515b548be77587bcfa18d45c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Tue, 25 Apr 2023 16:55:39 +0200 Subject: [PATCH 3/3] Make rustfmt happy --- milli/src/search/criteria/exactness.rs | 8 ++------ milli/src/search/query_tree.rs | 8 +++----- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/milli/src/search/criteria/exactness.rs b/milli/src/search/criteria/exactness.rs index 6ca5735b7..879bdcdb3 100644 --- a/milli/src/search/criteria/exactness.rs +++ b/milli/src/search/criteria/exactness.rs @@ -658,9 +658,7 @@ mod tests { let dividers = [2, 3, 5, 7, 11, 6, 15, 35, 18, 14]; let parts_candidates: Vec = dividers .iter() - .map(|÷r| { - (0..).map(|x| divider * x).take_while(|x| *x <= 210).collect() - }) + .map(|÷r| (0..).map(|x| divider * x).take_while(|x| *x <= 210).collect()) .collect(); let combinations = create_disjoint_combinations(parts_candidates); @@ -688,9 +686,7 @@ mod tests { ]; let parts_candidates: Vec = dividers .iter() - .map(|divider| { - (0..).map(|x| divider * x).take_while(|x| *x <= 100).collect() - }) + .map(|divider| (0..).map(|x| divider * x).take_while(|x| *x <= 100).collect()) .collect(); let combinations = create_non_disjoint_combinations(parts_candidates.clone()); diff --git a/milli/src/search/query_tree.rs b/milli/src/search/query_tree.rs index 15b18b565..b2418c9c5 100755 --- a/milli/src/search/query_tree.rs +++ b/milli/src/search/query_tree.rs @@ -628,8 +628,7 @@ fn create_matching_words( } // create a CONSECUTIVE matchings words wrapping all word in the phrase PrimitiveQueryPart::Phrase(words) => { - let ids: Vec<_> = - (0..words.len()).map(|i| id + i as PrimitiveWordId).collect(); + let ids: Vec<_> = (0..words.len()).map(|i| id + i as PrimitiveWordId).collect(); // Require that all words of the phrase have a corresponding MatchingWord // before adding any of them to the matching_words result if let Some(phrase_matching_words) = words @@ -686,9 +685,8 @@ fn create_matching_words( } }) .collect(); - let ids: Vec<_> = (0..words.len()) - .map(|i| id + i as PrimitiveWordId) - .collect(); + let ids: Vec<_> = + (0..words.len()).map(|i| id + i as PrimitiveWordId).collect(); if let Some(synonyms) = ctx.synonyms(&words)? { for synonym in synonyms {