659: Fix clippy error to add clippy job on Ci r=Kerollmops a=unvalley

## Related PR
This PR is for #673 

## What does this PR do?
- ~~add `Run Clippy` job to CI (rust.yml)~~
- apply `cargo clippy --fix` command
- fix some `cargo clippy` error manually (but warnings still remain on tests)

## PR checklist
Please check if your PR fulfills the following requirements:
- [x] Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
- [x] Have you read the contributing guidelines?
- [x] Have you made sure that the title is accurate and descriptive of the changes?


Co-authored-by: unvalley <kirohi.code@gmail.com>
Co-authored-by: unvalley <38400669+unvalley@users.noreply.github.com>
This commit is contained in:
bors[bot]
2022-11-03 15:24:38 +00:00
committed by GitHub
31 changed files with 108 additions and 105 deletions

View File

@ -242,6 +242,7 @@ fn iterative_facet_number_ordered_iter<'t>(
// The itertools GroupBy iterator doesn't provide an owned version, we are therefore
// required to collect the result into an owned collection (a Vec).
// https://github.com/rust-itertools/itertools/issues/499
#[allow(clippy::needless_collect)]
let vec: Vec<_> = iter
.group_by(|(_, v)| *v)
.into_iter()
@ -284,6 +285,7 @@ fn iterative_facet_string_ordered_iter<'t>(
// The itertools GroupBy iterator doesn't provide an owned version, we are therefore
// required to collect the result into an owned collection (a Vec).
// https://github.com/rust-itertools/itertools/issues/499
#[allow(clippy::needless_collect)]
let vec: Vec<_> = iter
.group_by(|(_, v)| *v)
.into_iter()

View File

@ -179,6 +179,7 @@ impl<'t> Criterion for Attribute<'t> {
/// QueryPositionIterator is an Iterator over positions of a Query,
/// It contains iterators over words positions.
struct QueryPositionIterator<'t> {
#[allow(clippy::type_complexity)]
inner:
Vec<Peekable<Box<dyn Iterator<Item = heed::Result<((&'t str, u32), RoaringBitmap)>> + 't>>>,
}

View File

@ -96,6 +96,7 @@ pub trait Context<'c> {
&self,
docid: DocumentId,
) -> heed::Result<HashMap<String, RoaringBitmap>>;
#[allow(clippy::type_complexity)]
fn word_position_iterator(
&self,
word: &str,
@ -883,7 +884,7 @@ pub mod test {
let mut keys = word_docids.keys().collect::<Vec<_>>();
keys.sort_unstable();
let words_fst = fst::Set::from_iter(keys).unwrap().map_data(|v| Cow::Owned(v)).unwrap();
let words_fst = fst::Set::from_iter(keys).unwrap().map_data(Cow::Owned).unwrap();
TestContext {
words_fst,