From fbb1ba3de07b06bedf568e7d8d5a34d8fb9048ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Lecrenier?= Date: Sun, 19 Mar 2023 15:15:58 +0100 Subject: [PATCH] Cargo fmt --- milli/src/lib.rs | 5 +---- milli/src/search/new/distinct.rs | 16 ++++++---------- milli/src/search/new/logger/detailed.rs | 4 +--- milli/src/search/new/mod.rs | 7 +++---- .../new/ranking_rule_graph/dead_ends_cache.rs | 6 ++---- .../new/ranking_rule_graph/proximity/build.rs | 3 ++- .../search/new/ranking_rule_graph/typo/mod.rs | 7 ++++--- 7 files changed, 19 insertions(+), 29 deletions(-) diff --git a/milli/src/lib.rs b/milli/src/lib.rs index 199221c7c..b256192bd 100644 --- a/milli/src/lib.rs +++ b/milli/src/lib.rs @@ -70,10 +70,6 @@ pub mod update; #[macro_use] pub mod snapshot_tests; -pub use search::new::DetailedSearchLogger; - -pub use search::new::{execute_search, DefaultSearchLogger, SearchContext}; - use std::collections::{BTreeMap, HashMap}; use std::convert::{TryFrom, TryInto}; use std::hash::BuildHasherDefault; @@ -81,6 +77,7 @@ use std::hash::BuildHasherDefault; pub use filter_parser::{Condition, FilterCondition, Span, Token}; use fxhash::{FxHasher32, FxHasher64}; pub use grenad::CompressionType; +pub use search::new::{execute_search, DefaultSearchLogger, DetailedSearchLogger, SearchContext}; use serde_json::Value; pub use {charabia as tokenizer, heed}; diff --git a/milli/src/search/new/distinct.rs b/milli/src/search/new/distinct.rs index 10657f210..f2e79603a 100644 --- a/milli/src/search/new/distinct.rs +++ b/milli/src/search/new/distinct.rs @@ -1,19 +1,15 @@ -use heed::{ - types::{ByteSlice, Str, Unit}, - Database, RoPrefix, RoTxn, -}; +use heed::types::{ByteSlice, Str, Unit}; +use heed::{Database, RoPrefix, RoTxn}; use roaring::RoaringBitmap; const FID_SIZE: usize = 2; const DOCID_SIZE: usize = 4; -use crate::{ - heed_codec::{ - facet::{FacetGroupKey, FacetGroupKeyCodec, FacetGroupValueCodec, FieldDocIdFacetCodec}, - ByteSliceRefCodec, - }, - Index, Result, SearchContext, +use crate::heed_codec::facet::{ + FacetGroupKey, FacetGroupKeyCodec, FacetGroupValueCodec, FieldDocIdFacetCodec, }; +use crate::heed_codec::ByteSliceRefCodec; +use crate::{Index, Result, SearchContext}; pub struct DistinctOutput { pub remaining: RoaringBitmap, diff --git a/milli/src/search/new/logger/detailed.rs b/milli/src/search/new/logger/detailed.rs index 23134c113..b519ca659 100644 --- a/milli/src/search/new/logger/detailed.rs +++ b/milli/src/search/new/logger/detailed.rs @@ -13,9 +13,7 @@ use crate::search::new::ranking_rule_graph::{ DeadEndsCache, Edge, ProximityCondition, ProximityGraph, RankingRuleGraph, RankingRuleGraphTrait, TypoCondition, TypoGraph, }; -use crate::search::new::small_bitmap::SmallBitmap; -use crate::search::new::{QueryGraph, QueryNode, SearchContext}; -use crate::search::new::{RankingRule, SearchLogger}; +use crate::search::new::{QueryGraph, QueryNode, RankingRule, SearchContext, SearchLogger}; pub enum SearchEvents { RankingRuleStartIteration { diff --git a/milli/src/search/new/mod.rs b/milli/src/search/new/mod.rs index 29a6020aa..c4e494242 100644 --- a/milli/src/search/new/mod.rs +++ b/milli/src/search/new/mod.rs @@ -16,17 +16,15 @@ mod sort; mod words; // #[cfg(test)] -pub use logger::detailed::DetailedSearchLogger; -pub use logger::{DefaultSearchLogger, SearchLogger}; - use std::collections::{BTreeSet, HashSet}; -use crate::{Filter, Index, MatchingWords, Result, Search, SearchResult, TermsMatchingStrategy}; use charabia::Tokenize; use db_cache::DatabaseCache; use graph_based_ranking_rule::{Proximity, Typo}; use heed::RoTxn; use interner::DedupInterner; +pub use logger::detailed::DetailedSearchLogger; +pub use logger::{DefaultSearchLogger, SearchLogger}; use query_graph::{QueryGraph, QueryNode, QueryNodeData}; use query_term::{located_query_terms_from_string, Phrase, QueryTerm}; use ranking_rules::{bucket_sort, PlaceholderQuery, RankingRuleOutput, RankingRuleQueryTrait}; @@ -35,6 +33,7 @@ use roaring::RoaringBitmap; use words::Words; use self::ranking_rules::RankingRule; +use crate::{Filter, Index, MatchingWords, Result, Search, SearchResult, TermsMatchingStrategy}; /// A structure used throughout the execution of a search query. pub struct SearchContext<'ctx> { diff --git a/milli/src/search/new/ranking_rule_graph/dead_ends_cache.rs b/milli/src/search/new/ranking_rule_graph/dead_ends_cache.rs index ecb6ae8da..d25c69c23 100644 --- a/milli/src/search/new/ranking_rule_graph/dead_ends_cache.rs +++ b/milli/src/search/new/ranking_rule_graph/dead_ends_cache.rs @@ -1,7 +1,5 @@ -use crate::search::new::{ - interner::{FixedSizeInterner, Interned}, - small_bitmap::SmallBitmap, -}; +use crate::search::new::interner::{FixedSizeInterner, Interned}; +use crate::search::new::small_bitmap::SmallBitmap; pub struct DeadEndsCache { conditions: Vec>, diff --git a/milli/src/search/new/ranking_rule_graph/proximity/build.rs b/milli/src/search/new/ranking_rule_graph/proximity/build.rs index 5e38a1879..d0977d732 100644 --- a/milli/src/search/new/ranking_rule_graph/proximity/build.rs +++ b/milli/src/search/new/ranking_rule_graph/proximity/build.rs @@ -1,6 +1,8 @@ #![allow(clippy::too_many_arguments)] use std::collections::BTreeMap; +use heed::RoTxn; + use super::ProximityCondition; use crate::search::new::db_cache::DatabaseCache; use crate::search::new::interner::{DedupInterner, Interned}; @@ -9,7 +11,6 @@ use crate::search::new::query_term::{LocatedQueryTerm, Phrase, QueryTerm}; use crate::search::new::ranking_rule_graph::proximity::WordPair; use crate::search::new::{QueryNode, SearchContext}; use crate::Result; -use heed::RoTxn; fn last_word_of_term_iter<'t>( t: &'t QueryTerm, diff --git a/milli/src/search/new/ranking_rule_graph/typo/mod.rs b/milli/src/search/new/ranking_rule_graph/typo/mod.rs index 854bd589b..6b8fc1154 100644 --- a/milli/src/search/new/ranking_rule_graph/typo/mod.rs +++ b/milli/src/search/new/ranking_rule_graph/typo/mod.rs @@ -1,3 +1,7 @@ +use std::collections::HashSet; +use std::fmt::Write; +use std::iter::FromIterator; + use roaring::RoaringBitmap; use super::{DeadEndsCache, RankingRuleGraph, RankingRuleGraphTrait}; @@ -7,9 +11,6 @@ use crate::search::new::query_graph::QueryNodeData; use crate::search::new::query_term::{LocatedQueryTerm, Phrase, QueryTerm}; use crate::search::new::{QueryGraph, QueryNode, SearchContext}; use crate::Result; -use std::collections::HashSet; -use std::fmt::Write; -use std::iter::FromIterator; #[derive(Clone, PartialEq, Eq, Hash)] pub struct TypoCondition {