Fix clippy errors

Add clippy job

Add clippy job to CI
This commit is contained in:
unvalley
2022-11-04 08:52:54 +09:00
parent 401e956128
commit 3009981d31
9 changed files with 28 additions and 18 deletions

View File

@ -432,18 +432,10 @@ pub fn resolve_phrase(ctx: &dyn Context, phrase: &[Option<String>]) -> Result<Ro
// Get all the documents with the matching distance for each word pairs.
let mut bitmaps = Vec::with_capacity(winsize.pow(2));
for (offset, s1) in win.iter().enumerate().filter_map(|(index, word)| {
if let Some(word) = word {
Some((index, word))
} else {
None
}
word.as_ref().map(|word| (index, word))
}) {
for (dist, s2) in win.iter().skip(offset + 1).enumerate().filter_map(|(index, word)| {
if let Some(word) = word {
Some((index, word))
} else {
None
}
word.as_ref().map(|word| (index, word))
}) {
if dist == 0 {
match ctx.word_pair_proximity_docids(s1, s2, 1)? {

View File

@ -488,7 +488,7 @@ fn resolve_plane_sweep_candidates(
}
// make a consecutive plane-sweep on the subgroup of words.
let mut subgroup = Vec::with_capacity(words.len());
for word in words.into_iter().map(|w| w.as_deref().unwrap()) {
for word in words.iter().map(|w| w.as_deref().unwrap()) {
match words_positions.get(word) {
Some(positions) => {
subgroup.push(positions.iter().map(|p| (p, 0, p)).collect())

View File

@ -591,7 +591,7 @@ fn create_matching_words(
(0..words.len()).into_iter().map(|i| id + i as PrimitiveWordId).collect();
let words = words
.into_iter()
.filter_map(|w| w)
.flatten()
.map(|w| MatchingWord::new(w, 0, false))
.collect();
matching_words.push((words, ids));