diff --git a/milli/src/error.rs b/milli/src/error.rs index 539861e73..d0a4d35ef 100644 --- a/milli/src/error.rs +++ b/milli/src/error.rs @@ -172,7 +172,7 @@ only composed of alphanumeric characters (a-z A-Z 0-9), hyphens (-) and undersco TooManyDocumentIds { primary_key: String, document: Object }, #[error("The primary key inference failed as the engine did not find any field ending with `id` in its name. Please specify the primary key manually using the `primaryKey` query parameter.")] NoPrimaryKeyCandidateFound, - #[error("The primary key inference failed as the engine found {} fields ending with `id` in their names: '{}' and '{}'. Please specify the primary key manually using the `primaryKey` query parameter.", .candidates.len(), .candidates.get(0).unwrap(), .candidates.get(1).unwrap())] + #[error("The primary key inference failed as the engine found {} fields ending with `id` in their names: '{}' and '{}'. Please specify the primary key manually using the `primaryKey` query parameter.", .candidates.len(), .candidates.first().unwrap(), .candidates.get(1).unwrap())] MultiplePrimaryKeyCandidatesFound { candidates: Vec }, #[error("There is no more space left on the device. Consider increasing the size of the disk/partition.")] NoSpaceLeftOnDevice, diff --git a/milli/src/search/facet/facet_sort_ascending.rs b/milli/src/search/facet/facet_sort_ascending.rs index 20c277c63..07fe64510 100644 --- a/milli/src/search/facet/facet_sort_ascending.rs +++ b/milli/src/search/facet/facet_sort_ascending.rs @@ -181,7 +181,7 @@ mod tests { get_simple_string_index_with_multiple_field_ids(), get_random_looking_string_index_with_multiple_field_ids(), ]; - for (_i, index) in indexes.iter().enumerate() { + for index in indexes { let txn = index.env.read_txn().unwrap(); let candidates = RoaringBitmap::new(); let mut results = String::new(); @@ -212,7 +212,7 @@ mod tests { get_simple_string_index_with_multiple_field_ids(), get_random_looking_string_index_with_multiple_field_ids(), ]; - for (_i, index) in indexes.iter().enumerate() { + for index in indexes { let txn = index.env.read_txn().unwrap(); let candidates = RoaringBitmap::new(); let mut results = String::new(); diff --git a/milli/src/search/facet/facet_sort_descending.rs b/milli/src/search/facet/facet_sort_descending.rs index ae6eb60d0..dd2692012 100644 --- a/milli/src/search/facet/facet_sort_descending.rs +++ b/milli/src/search/facet/facet_sort_descending.rs @@ -195,7 +195,7 @@ mod tests { get_simple_string_index_with_multiple_field_ids(), get_random_looking_string_index_with_multiple_field_ids(), ]; - for (_i, index) in indexes.iter().enumerate() { + for index in indexes { let txn = index.env.read_txn().unwrap(); let candidates = RoaringBitmap::new(); let mut results = String::new(); @@ -226,7 +226,7 @@ mod tests { get_simple_string_index_with_multiple_field_ids(), get_random_looking_string_index_with_multiple_field_ids(), ]; - for (_i, index) in indexes.iter().enumerate() { + for index in indexes { let txn = index.env.read_txn().unwrap(); let candidates = RoaringBitmap::new(); let mut results = String::new(); diff --git a/milli/src/search/facet/mod.rs b/milli/src/search/facet/mod.rs index f44d6a153..f676ee109 100644 --- a/milli/src/search/facet/mod.rs +++ b/milli/src/search/facet/mod.rs @@ -142,7 +142,7 @@ pub(crate) mod tests { let mut txn = index.env.write_txn().unwrap(); let mut rng = rand::rngs::SmallRng::from_seed([0; 32]); - for (_i, key) in std::iter::from_fn(|| Some(rng.gen_range(0..256))).take(128).enumerate() { + for key in std::iter::from_fn(|| Some(rng.gen_range(0..256))).take(128) { let mut bitmap = RoaringBitmap::new(); bitmap.insert(key); bitmap.insert(key + 100); @@ -172,7 +172,7 @@ pub(crate) mod tests { let keys = std::iter::from_fn(|| Some(rng.gen_range(0..256))).take(128).collect::>(); for fid in 0..2 { - for (_i, &key) in keys.iter().enumerate() { + for &key in &keys { let mut bitmap = RoaringBitmap::new(); bitmap.insert(key); bitmap.insert(key + 100); @@ -207,7 +207,7 @@ pub(crate) mod tests { let keys = std::iter::from_fn(|| Some(rng.gen_range(0..256))).take(128).collect::>(); for fid in 0..2 { - for (_i, &key) in keys.iter().enumerate() { + for &key in &keys { let mut bitmap = RoaringBitmap::new(); bitmap.insert(key); bitmap.insert(key + 100); diff --git a/milli/src/update/facet/incremental.rs b/milli/src/update/facet/incremental.rs index 9d8ee08f4..78db218e3 100644 --- a/milli/src/update/facet/incremental.rs +++ b/milli/src/update/facet/incremental.rs @@ -751,7 +751,7 @@ mod tests { let mut rng = rand::rngs::SmallRng::from_seed([0; 32]); keys.shuffle(&mut rng); - for (_i, key) in keys.into_iter().enumerate() { + for key in keys { let mut bitmap = RoaringBitmap::new(); bitmap.insert(key); index.insert(&mut txn, 0, &(key as f64), &bitmap); @@ -770,7 +770,7 @@ mod tests { let mut rng = rand::rngs::SmallRng::from_seed([0; 32]); keys.shuffle(&mut rng); - for (_i, key) in keys.into_iter().enumerate() { + for key in keys { let mut bitmap = RoaringBitmap::new(); bitmap.insert(key); bitmap.insert(rng.gen_range(256..512)); diff --git a/milli/src/update/index_documents/extract/extract_word_pair_proximity_docids.rs b/milli/src/update/index_documents/extract/extract_word_pair_proximity_docids.rs index b8a377247..d364b3e13 100644 --- a/milli/src/update/index_documents/extract/extract_word_pair_proximity_docids.rs +++ b/milli/src/update/index_documents/extract/extract_word_pair_proximity_docids.rs @@ -77,7 +77,7 @@ pub fn extract_word_pair_proximity_docids( if let Some(deletion) = KvReaderDelAdd::new(value).get(DelAdd::Deletion) { for (position, word) in KvReaderU16::new(deletion).iter() { // drain the proximity window until the head word is considered close to the word we are inserting. - while del_word_positions.get(0).map_or(false, |(_w, p)| { + while del_word_positions.front().map_or(false, |(_w, p)| { index_proximity(*p as u32, position as u32) >= MAX_DISTANCE }) { word_positions_into_word_pair_proximity( @@ -106,7 +106,7 @@ pub fn extract_word_pair_proximity_docids( if let Some(addition) = KvReaderDelAdd::new(value).get(DelAdd::Addition) { for (position, word) in KvReaderU16::new(addition).iter() { // drain the proximity window until the head word is considered close to the word we are inserting. - while add_word_positions.get(0).map_or(false, |(_w, p)| { + while add_word_positions.front().map_or(false, |(_w, p)| { index_proximity(*p as u32, position as u32) >= MAX_DISTANCE }) { word_positions_into_word_pair_proximity(