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
commit 6add470805
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 108 additions and 105 deletions

View file

@ -20,7 +20,7 @@ mod query_criteria;
mod sort;
mod typo_tolerance;
pub const TEST_QUERY: &'static str = "hello world america";
pub const TEST_QUERY: &str = "hello world america";
pub const EXTERNAL_DOCUMENTS_IDS: &[&str; 17] =
&["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q"];
@ -178,7 +178,7 @@ fn execute_filter(filter: &str, document: &TestDocument) -> Option<String> {
{
id = Some(document.id.clone())
}
} else if let Some((field, filter)) = filter.split_once("=") {
} else if let Some((field, filter)) = filter.split_once('=') {
if field == "tag" && document.tag == filter {
id = Some(document.id.clone())
} else if field == "asc_desc_rank"
@ -186,11 +186,11 @@ fn execute_filter(filter: &str, document: &TestDocument) -> Option<String> {
{
id = Some(document.id.clone())
}
} else if let Some(("asc_desc_rank", filter)) = filter.split_once("<") {
} else if let Some(("asc_desc_rank", filter)) = filter.split_once('<') {
if document.asc_desc_rank < filter.parse().unwrap() {
id = Some(document.id.clone())
}
} else if let Some(("asc_desc_rank", filter)) = filter.split_once(">") {
} else if let Some(("asc_desc_rank", filter)) = filter.split_once('>') {
if document.asc_desc_rank > filter.parse().unwrap() {
id = Some(document.id.clone())
}

View file

@ -200,7 +200,7 @@ test_criterion!(
#[test]
fn criteria_mixup() {
use Criterion::*;
let index = search::setup_search_index_with_criteria(&vec![
let index = search::setup_search_index_with_criteria(&[
Words,
Attribute,
Desc(S("asc_desc_rank")),