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

@ -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 }]}"##
);
}
}