clippy + fmt

This commit is contained in:
marin postma 2021-06-23 14:48:33 +02:00
parent b000ae7614
commit 834995b130
No known key found for this signature in database
GPG key ID: 6088B7721C3E39F9
13 changed files with 78 additions and 53 deletions

View file

@ -3,7 +3,7 @@ use std::io::{BufRead, BufReader, Write};
use std::path::Path;
use std::sync::Arc;
use anyhow::{Context, bail};
use anyhow::{bail, Context};
use heed::RoTxn;
use indexmap::IndexMap;
use milli::update::{IndexDocumentsMethod, UpdateFormat::JsonStream};

View file

@ -13,7 +13,7 @@ use serde_json::{Map, Value};
use crate::helpers::EnvSizer;
use error::Result;
pub use search::{SearchQuery, SearchResult, DEFAULT_SEARCH_LIMIT, default_crop_length};
pub use search::{default_crop_length, SearchQuery, SearchResult, DEFAULT_SEARCH_LIMIT};
pub use updates::{Checked, Facets, Settings, Unchecked};
use self::error::IndexError;

View file

@ -233,8 +233,8 @@ impl Index {
fn compute_matches<A: AsRef<[u8]>>(
matcher: &impl Matcher,
document: &Document,
analyzer: &Analyzer<A>
) -> MatchesInfo {
analyzer: &Analyzer<A>,
) -> MatchesInfo {
let mut matches = BTreeMap::new();
for (key, value) in document {
@ -1174,6 +1174,9 @@ mod test {
let analyzer = Analyzer::new(config);
let matches = compute_matches(&matcher, &value, &analyzer);
assert_eq!(format!("{:?}", matches), r##"{"about": [MatchInfo { start: 0, length: 6 }, MatchInfo { start: 31, length: 7 }, MatchInfo { start: 191, length: 7 }, MatchInfo { start: 225, length: 7 }, MatchInfo { start: 233, length: 6 }], "color": [MatchInfo { start: 0, length: 3 }]}"##);
assert_eq!(
format!("{:?}", matches),
r##"{"about": [MatchInfo { start: 0, length: 6 }, MatchInfo { start: 31, length: 7 }, MatchInfo { start: 191, length: 7 }, MatchInfo { start: 225, length: 7 }, MatchInfo { start: 233, length: 6 }], "color": [MatchInfo { start: 0, length: 3 }]}"##
);
}
}