From 58b417e04531d0a9669a88f964a6dda47fe441bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Tue, 12 Feb 2019 15:43:43 +0100 Subject: [PATCH] feat: Replace the linear_group_by by the new linear_group method --- src/rank/criterion/exact.rs | 2 +- src/rank/criterion/number_of_words.rs | 2 +- src/rank/criterion/sum_of_typos.rs | 2 +- src/rank/criterion/sum_of_words_attribute.rs | 2 +- src/rank/criterion/sum_of_words_position.rs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/rank/criterion/exact.rs b/src/rank/criterion/exact.rs index 54b5b7b9f..6933aaff5 100644 --- a/src/rank/criterion/exact.rs +++ b/src/rank/criterion/exact.rs @@ -10,7 +10,7 @@ fn number_exact_matches(query_index: &[u32], is_exact: &[bool]) -> usize { let mut count = 0; let mut index = 0; - for group in query_index.linear_group_by(PartialEq::eq) { + for group in query_index.linear_group() { let len = group.len(); count += is_exact[index..index + len].contains(&true) as usize; index += len; diff --git a/src/rank/criterion/number_of_words.rs b/src/rank/criterion/number_of_words.rs index c8dd1edb4..0c6f5a200 100644 --- a/src/rank/criterion/number_of_words.rs +++ b/src/rank/criterion/number_of_words.rs @@ -7,7 +7,7 @@ use crate::rank::RawDocument; #[inline] fn number_of_query_words(query_index: &[u32]) -> usize { - query_index.linear_group_by(PartialEq::eq).count() + query_index.linear_group().count() } #[derive(Debug, Clone, Copy)] diff --git a/src/rank/criterion/sum_of_typos.rs b/src/rank/criterion/sum_of_typos.rs index 0f7edbbd5..c218293e3 100644 --- a/src/rank/criterion/sum_of_typos.rs +++ b/src/rank/criterion/sum_of_typos.rs @@ -11,7 +11,7 @@ fn sum_matches_typos(query_index: &[u32], distance: &[u8]) -> isize { let mut sum_typos = 0.0; let mut index = 0; - for group in query_index.linear_group_by(PartialEq::eq) { + for group in query_index.linear_group() { let typo = distance[index] as f32; sum_typos += (typo + 1.0).log10(); number_words += 1.0_f32; diff --git a/src/rank/criterion/sum_of_words_attribute.rs b/src/rank/criterion/sum_of_words_attribute.rs index 5c42f8552..0a5303490 100644 --- a/src/rank/criterion/sum_of_words_attribute.rs +++ b/src/rank/criterion/sum_of_words_attribute.rs @@ -10,7 +10,7 @@ fn sum_matches_attributes(query_index: &[u32], attribute: &[u16]) -> usize { let mut sum_attributes = 0; let mut index = 0; - for group in query_index.linear_group_by(PartialEq::eq) { + for group in query_index.linear_group() { sum_attributes += attribute[index] as usize; index += group.len(); } diff --git a/src/rank/criterion/sum_of_words_position.rs b/src/rank/criterion/sum_of_words_position.rs index ad93dc4a8..73ea5978c 100644 --- a/src/rank/criterion/sum_of_words_position.rs +++ b/src/rank/criterion/sum_of_words_position.rs @@ -10,7 +10,7 @@ fn sum_matches_attribute_index(query_index: &[u32], word_index: &[u32]) -> usize let mut sum_word_index = 0; let mut index = 0; - for group in query_index.linear_group_by(PartialEq::eq) { + for group in query_index.linear_group() { sum_word_index += word_index[index] as usize; index += group.len(); }