From 1aaf24ccbf26590ee0979e18adb09dc3a7a6c8b9 Mon Sep 17 00:00:00 2001 From: Louis Dureuil Date: Wed, 3 May 2023 12:21:58 +0200 Subject: [PATCH] Cargo fmt --- milli/src/heed_codec/mod.rs | 2 +- milli/src/search/new/query_graph.rs | 10 ++++++---- milli/src/search/new/query_term/ntypo_subset.rs | 3 +-- milli/src/search/new/query_term/phrase.rs | 3 ++- milli/src/search/new/ranking_rule_graph/build.rs | 3 ++- milli/src/search/new/tests/attribute_fid.rs | 3 ++- milli/src/search/new/tests/attribute_position.rs | 5 ++--- milli/src/search/new/tests/distinct.rs | 7 ++----- milli/src/search/new/tests/exactness.rs | 7 +++---- milli/src/search/new/tests/integration.rs | 9 +++------ milli/src/search/new/tests/language.rs | 3 ++- milli/src/search/new/tests/ngram_split_words.rs | 7 +++---- milli/src/search/new/tests/proximity.rs | 7 +++---- milli/src/search/new/tests/proximity_typo.rs | 7 +++---- milli/src/search/new/tests/sort.rs | 7 +++---- milli/src/search/new/tests/stop_words.rs | 6 ++++-- milli/src/search/new/tests/typo_proximity.rs | 7 +++---- milli/src/search/new/tests/words_tms.rs | 7 +++---- 18 files changed, 48 insertions(+), 55 deletions(-) diff --git a/milli/src/heed_codec/mod.rs b/milli/src/heed_codec/mod.rs index b7a8c3c88..de2644e11 100644 --- a/milli/src/heed_codec/mod.rs +++ b/milli/src/heed_codec/mod.rs @@ -21,5 +21,5 @@ pub use self::roaring_bitmap_length::{ BoRoaringBitmapLenCodec, CboRoaringBitmapLenCodec, RoaringBitmapLenCodec, }; pub use self::script_language_codec::ScriptLanguageCodec; -pub use self::str_beu32_codec::{StrBEU32Codec, StrBEU16Codec}; +pub use self::str_beu32_codec::{StrBEU16Codec, StrBEU32Codec}; pub use self::str_str_u8_codec::{U8StrStrCodec, UncheckedU8StrStrCodec}; diff --git a/milli/src/search/new/query_graph.rs b/milli/src/search/new/query_graph.rs index 0c3191390..0e7d5a7f3 100644 --- a/milli/src/search/new/query_graph.rs +++ b/milli/src/search/new/query_graph.rs @@ -1,3 +1,9 @@ +use std::cmp::Ordering; +use std::collections::BTreeMap; +use std::hash::{Hash, Hasher}; + +use fxhash::{FxHashMap, FxHasher}; + use super::interner::{FixedSizeInterner, Interned}; use super::query_term::{ self, number_of_typos_allowed, LocatedQueryTerm, LocatedQueryTermSubset, QueryTermSubset, @@ -6,10 +12,6 @@ use super::small_bitmap::SmallBitmap; use super::SearchContext; use crate::search::new::interner::Interner; use crate::Result; -use fxhash::{FxHashMap, FxHasher}; -use std::cmp::Ordering; -use std::collections::BTreeMap; -use std::hash::{Hash, Hasher}; /// A node of the [`QueryGraph`]. /// diff --git a/milli/src/search/new/query_term/ntypo_subset.rs b/milli/src/search/new/query_term/ntypo_subset.rs index ad25d73c7..bbc2236b0 100644 --- a/milli/src/search/new/query_term/ntypo_subset.rs +++ b/milli/src/search/new/query_term/ntypo_subset.rs @@ -1,8 +1,7 @@ use std::collections::BTreeSet; -use crate::search::new::interner::Interned; - use super::Phrase; +use crate::search::new::interner::Interned; #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum NTypoTermSubset { diff --git a/milli/src/search/new/query_term/phrase.rs b/milli/src/search/new/query_term/phrase.rs index 033c5cf12..1d0b24196 100644 --- a/milli/src/search/new/query_term/phrase.rs +++ b/milli/src/search/new/query_term/phrase.rs @@ -1,6 +1,7 @@ use itertools::Itertools; -use crate::{search::new::interner::Interned, SearchContext}; +use crate::search::new::interner::Interned; +use crate::SearchContext; /// A phrase in the user's search query, consisting of several words /// that must appear side-by-side in the search results. diff --git a/milli/src/search/new/ranking_rule_graph/build.rs b/milli/src/search/new/ranking_rule_graph/build.rs index c92eac526..015cd9845 100644 --- a/milli/src/search/new/ranking_rule_graph/build.rs +++ b/milli/src/search/new/ranking_rule_graph/build.rs @@ -1,10 +1,11 @@ +use std::collections::HashSet; + use super::{Edge, RankingRuleGraph, RankingRuleGraphTrait}; use crate::search::new::interner::{DedupInterner, MappedInterner}; use crate::search::new::query_graph::{QueryNode, QueryNodeData}; use crate::search::new::small_bitmap::SmallBitmap; use crate::search::new::{QueryGraph, SearchContext}; use crate::Result; -use std::collections::HashSet; impl RankingRuleGraph { /// Build the ranking rule graph from the given query graph diff --git a/milli/src/search/new/tests/attribute_fid.rs b/milli/src/search/new/tests/attribute_fid.rs index d71c57f2c..177dc393a 100644 --- a/milli/src/search/new/tests/attribute_fid.rs +++ b/milli/src/search/new/tests/attribute_fid.rs @@ -1,4 +1,5 @@ -use crate::{index::tests::TempIndex, Criterion, Search, SearchResult, TermsMatchingStrategy}; +use crate::index::tests::TempIndex; +use crate::{Criterion, Search, SearchResult, TermsMatchingStrategy}; fn create_index() -> TempIndex { let index = TempIndex::new(); diff --git a/milli/src/search/new/tests/attribute_position.rs b/milli/src/search/new/tests/attribute_position.rs index 08b38684b..5e16cd023 100644 --- a/milli/src/search/new/tests/attribute_position.rs +++ b/milli/src/search/new/tests/attribute_position.rs @@ -1,6 +1,5 @@ -use crate::{ - db_snap, index::tests::TempIndex, Criterion, Search, SearchResult, TermsMatchingStrategy, -}; +use crate::index::tests::TempIndex; +use crate::{db_snap, Criterion, Search, SearchResult, TermsMatchingStrategy}; fn create_index() -> TempIndex { let index = TempIndex::new(); diff --git a/milli/src/search/new/tests/distinct.rs b/milli/src/search/new/tests/distinct.rs index 74e0cdca0..2c147d514 100644 --- a/milli/src/search/new/tests/distinct.rs +++ b/milli/src/search/new/tests/distinct.rs @@ -17,12 +17,9 @@ use big_s::S; use heed::RoTxn; use maplit::hashset; -use crate::{ - index::tests::TempIndex, AscDesc, Criterion, Index, Member, Search, SearchResult, - TermsMatchingStrategy, -}; - use super::collect_field_values; +use crate::index::tests::TempIndex; +use crate::{AscDesc, Criterion, Index, Member, Search, SearchResult, TermsMatchingStrategy}; fn create_index() -> TempIndex { let index = TempIndex::new(); diff --git a/milli/src/search/new/tests/exactness.rs b/milli/src/search/new/tests/exactness.rs index 7543959d3..b45c0529c 100644 --- a/milli/src/search/new/tests/exactness.rs +++ b/milli/src/search/new/tests/exactness.rs @@ -19,10 +19,9 @@ Then these rules will only work with 2. the full query term otherwise */ -use crate::{ - index::tests::TempIndex, search::new::tests::collect_field_values, Criterion, Search, - SearchResult, TermsMatchingStrategy, -}; +use crate::index::tests::TempIndex; +use crate::search::new::tests::collect_field_values; +use crate::{Criterion, Search, SearchResult, TermsMatchingStrategy}; fn create_index_simple_ordered() -> TempIndex { let index = TempIndex::new(); diff --git a/milli/src/search/new/tests/integration.rs b/milli/src/search/new/tests/integration.rs index 153a80343..3abb1878f 100644 --- a/milli/src/search/new/tests/integration.rs +++ b/milli/src/search/new/tests/integration.rs @@ -4,12 +4,9 @@ use big_s::S; use heed::EnvOpenOptions; use maplit::{hashmap, hashset}; -use crate::{ - db_snap, - documents::{DocumentsBatchBuilder, DocumentsBatchReader}, - update::{IndexDocuments, IndexDocumentsConfig, IndexerConfig, Settings}, - Criterion, Index, Object, -}; +use crate::documents::{DocumentsBatchBuilder, DocumentsBatchReader}; +use crate::update::{IndexDocuments, IndexDocumentsConfig, IndexerConfig, Settings}; +use crate::{db_snap, Criterion, Index, Object}; pub const CONTENT: &str = include_str!("../../../../tests/assets/test_set.ndjson"); pub fn setup_search_index_with_criteria(criteria: &[Criterion]) -> Index { diff --git a/milli/src/search/new/tests/language.rs b/milli/src/search/new/tests/language.rs index e16544fdb..0724b32a4 100644 --- a/milli/src/search/new/tests/language.rs +++ b/milli/src/search/new/tests/language.rs @@ -1,4 +1,5 @@ -use crate::{index::tests::TempIndex, Search, SearchResult}; +use crate::index::tests::TempIndex; +use crate::{Search, SearchResult}; #[test] fn test_kanji_language_detection() { diff --git a/milli/src/search/new/tests/ngram_split_words.rs b/milli/src/search/new/tests/ngram_split_words.rs index b78bbe763..2a0365bac 100644 --- a/milli/src/search/new/tests/ngram_split_words.rs +++ b/milli/src/search/new/tests/ngram_split_words.rs @@ -16,10 +16,9 @@ This module tests the following properties: 13. Ngrams cannot be formed by combining a phrase and a word or two phrases */ -use crate::{ - index::tests::TempIndex, search::new::tests::collect_field_values, Criterion, Search, - SearchResult, TermsMatchingStrategy, -}; +use crate::index::tests::TempIndex; +use crate::search::new::tests::collect_field_values; +use crate::{Criterion, Search, SearchResult, TermsMatchingStrategy}; fn create_index() -> TempIndex { let index = TempIndex::new(); diff --git a/milli/src/search/new/tests/proximity.rs b/milli/src/search/new/tests/proximity.rs index 880f933f0..401508866 100644 --- a/milli/src/search/new/tests/proximity.rs +++ b/milli/src/search/new/tests/proximity.rs @@ -17,10 +17,9 @@ they store fewer sprximities than the regular word sprximity DB. use std::collections::HashMap; -use crate::{ - index::tests::TempIndex, search::new::tests::collect_field_values, Criterion, Search, - SearchResult, TermsMatchingStrategy, -}; +use crate::index::tests::TempIndex; +use crate::search::new::tests::collect_field_values; +use crate::{Criterion, Search, SearchResult, TermsMatchingStrategy}; fn create_simple_index() -> TempIndex { let index = TempIndex::new(); diff --git a/milli/src/search/new/tests/proximity_typo.rs b/milli/src/search/new/tests/proximity_typo.rs index 9f9601e3f..ab98f99c0 100644 --- a/milli/src/search/new/tests/proximity_typo.rs +++ b/milli/src/search/new/tests/proximity_typo.rs @@ -7,10 +7,9 @@ only contains the word pairs that it used to compute its bucket. TODO: This is not currently implemented. */ -use crate::{ - index::tests::TempIndex, search::new::tests::collect_field_values, Criterion, Search, - SearchResult, TermsMatchingStrategy, -}; +use crate::index::tests::TempIndex; +use crate::search::new::tests::collect_field_values; +use crate::{Criterion, Search, SearchResult, TermsMatchingStrategy}; fn create_index() -> TempIndex { let index = TempIndex::new(); diff --git a/milli/src/search/new/tests/sort.rs b/milli/src/search/new/tests/sort.rs index d2201f55b..52acc646c 100644 --- a/milli/src/search/new/tests/sort.rs +++ b/milli/src/search/new/tests/sort.rs @@ -14,10 +14,9 @@ This module tests the `sort` ranking rule: use big_s::S; use maplit::hashset; -use crate::{ - index::tests::TempIndex, search::new::tests::collect_field_values, AscDesc, Criterion, Member, - Search, SearchResult, TermsMatchingStrategy, -}; +use crate::index::tests::TempIndex; +use crate::search::new::tests::collect_field_values; +use crate::{AscDesc, Criterion, Member, Search, SearchResult, TermsMatchingStrategy}; fn create_index() -> TempIndex { let index = TempIndex::new(); diff --git a/milli/src/search/new/tests/stop_words.rs b/milli/src/search/new/tests/stop_words.rs index 9dd7f2cb0..92168f6d6 100644 --- a/milli/src/search/new/tests/stop_words.rs +++ b/milli/src/search/new/tests/stop_words.rs @@ -9,9 +9,11 @@ This module tests the following properties about stop words: - Phrases consisting only of stop words are ignored */ -use std::{collections::BTreeSet, iter::FromIterator}; +use std::collections::BTreeSet; +use std::iter::FromIterator; -use crate::{db_snap, index::tests::TempIndex, Search, SearchResult, TermsMatchingStrategy}; +use crate::index::tests::TempIndex; +use crate::{db_snap, Search, SearchResult, TermsMatchingStrategy}; fn create_index() -> TempIndex { let index = TempIndex::new(); diff --git a/milli/src/search/new/tests/typo_proximity.rs b/milli/src/search/new/tests/typo_proximity.rs index 220fc69e1..103cc4717 100644 --- a/milli/src/search/new/tests/typo_proximity.rs +++ b/milli/src/search/new/tests/typo_proximity.rs @@ -15,10 +15,9 @@ The proximity ranking rule is not allowed to look for the proximity between `bea because the typo ranking rule before it only used the derivation `beautiful`. */ -use crate::{ - index::tests::TempIndex, search::new::tests::collect_field_values, Criterion, Search, - SearchResult, TermsMatchingStrategy, -}; +use crate::index::tests::TempIndex; +use crate::search::new::tests::collect_field_values; +use crate::{Criterion, Search, SearchResult, TermsMatchingStrategy}; fn create_index() -> TempIndex { let index = TempIndex::new(); diff --git a/milli/src/search/new/tests/words_tms.rs b/milli/src/search/new/tests/words_tms.rs index 74748ea5a..826f9c47d 100644 --- a/milli/src/search/new/tests/words_tms.rs +++ b/milli/src/search/new/tests/words_tms.rs @@ -12,10 +12,9 @@ account by the proximity ranking rule. 7. The search is capable of returning no results if no documents match the query */ -use crate::{ - index::tests::TempIndex, search::new::tests::collect_field_values, Criterion, Search, - SearchResult, TermsMatchingStrategy, -}; +use crate::index::tests::TempIndex; +use crate::search::new::tests::collect_field_values; +use crate::{Criterion, Search, SearchResult, TermsMatchingStrategy}; fn create_index() -> TempIndex { let index = TempIndex::new();