From 178d00f93aebe3a688b32d548006d8e0e0d34393 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Lecrenier?= Date: Mon, 19 Sep 2022 11:03:52 +0200 Subject: [PATCH] Cargo fmt --- milli/src/update/prefix_word_pairs/mod.rs | 11 ++++++++--- .../src/update/prefix_word_pairs/prefix_word.rs | 14 ++++++++------ .../src/update/prefix_word_pairs/word_prefix.rs | 17 ++++++++++------- 3 files changed, 26 insertions(+), 16 deletions(-) diff --git a/milli/src/update/prefix_word_pairs/mod.rs b/milli/src/update/prefix_word_pairs/mod.rs index 63286f8da..1549acf40 100644 --- a/milli/src/update/prefix_word_pairs/mod.rs +++ b/milli/src/update/prefix_word_pairs/mod.rs @@ -1,7 +1,11 @@ +use std::borrow::Cow; +use std::collections::HashSet; +use std::io::BufReader; + +use heed::types::ByteSlice; + use super::index_documents::{merge_cbo_roaring_bitmaps, CursorClonableMmap}; use crate::{Index, Result}; -use heed::types::ByteSlice; -use std::{borrow::Cow, collections::HashSet, io::BufReader}; mod prefix_word; mod word_prefix; @@ -131,10 +135,11 @@ pub fn write_into_lmdb_database_without_merging( #[cfg(test)] mod tests { + use std::io::Cursor; + use crate::db_snap; use crate::documents::{DocumentsBatchBuilder, DocumentsBatchReader}; use crate::index::tests::TempIndex; - use std::io::Cursor; fn documents_with_enough_different_words_for_prefixes(prefixes: &[&str]) -> Vec { let mut documents = Vec::new(); diff --git a/milli/src/update/prefix_word_pairs/prefix_word.rs b/milli/src/update/prefix_word_pairs/prefix_word.rs index 18f5bdc5a..0cd55c929 100644 --- a/milli/src/update/prefix_word_pairs/prefix_word.rs +++ b/milli/src/update/prefix_word_pairs/prefix_word.rs @@ -1,14 +1,16 @@ +use std::borrow::Cow; +use std::collections::{BTreeMap, HashSet}; + +use grenad::CompressionType; +use heed::types::ByteSlice; +use heed::BytesDecode; +use log::debug; + use crate::update::index_documents::{create_writer, CursorClonableMmap}; use crate::update::prefix_word_pairs::{ insert_into_database, write_into_lmdb_database_without_merging, }; use crate::{CboRoaringBitmapCodec, Result, U8StrStrCodec, UncheckedU8StrStrCodec}; -use grenad::CompressionType; -use heed::types::ByteSlice; -use heed::BytesDecode; -use log::debug; -use std::borrow::Cow; -use std::collections::{BTreeMap, HashSet}; #[logging_timer::time] pub fn index_prefix_word_database( diff --git a/milli/src/update/prefix_word_pairs/word_prefix.rs b/milli/src/update/prefix_word_pairs/word_prefix.rs index bd1bea2a3..1c7a4fffe 100644 --- a/milli/src/update/prefix_word_pairs/word_prefix.rs +++ b/milli/src/update/prefix_word_pairs/word_prefix.rs @@ -163,17 +163,19 @@ Writer instead of the DB. At the end of the outer loop, we finally read from the grenad and insert its elements in the database. */ +use std::borrow::Cow; +use std::collections::HashSet; + +use grenad::CompressionType; +use heed::types::ByteSlice; +use heed::BytesDecode; +use log::debug; + use crate::update::index_documents::{create_writer, CursorClonableMmap}; use crate::update::prefix_word_pairs::{ insert_into_database, write_into_lmdb_database_without_merging, }; use crate::{CboRoaringBitmapCodec, Result, U8StrStrCodec, UncheckedU8StrStrCodec}; -use grenad::CompressionType; -use heed::types::ByteSlice; -use heed::BytesDecode; -use log::debug; -use std::borrow::Cow; -use std::collections::HashSet; #[logging_timer::time] pub fn index_word_prefix_database( @@ -562,9 +564,10 @@ impl PrefixTrieNode { } #[cfg(test)] mod tests { + use roaring::RoaringBitmap; + use super::*; use crate::{CboRoaringBitmapCodec, U8StrStrCodec}; - use roaring::RoaringBitmap; fn check_prefixes( trie: &PrefixTrieNode,