mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-12-23 21:20:24 +01:00
Merge #1100
1100: [fix] Remove some clippy warnings r=MarinPostma a=woshilapin fix #1099 I'm also wondering if I should add `-- --deny warnings` to the modified line in `test.yml`. Co-authored-by: Jean SIMARD <woshilapin@tuziwo.info>
This commit is contained in:
commit
b8e677efd2
@ -349,8 +349,8 @@ fn search_command(command: SearchCommand, database: Database) -> Result<(), Box<
|
||||
|
||||
if let Some(ref filter) = command.filter {
|
||||
let filter = filter.as_str();
|
||||
let (positive, filter) = if filter.chars().next() == Some('!') {
|
||||
(false, &filter[1..])
|
||||
let (positive, filter) = if let Some(stripped) = filter.strip_prefix('!') {
|
||||
(false, stripped)
|
||||
} else {
|
||||
(true, filter)
|
||||
};
|
||||
|
@ -61,7 +61,7 @@ impl Server {
|
||||
..Opt::default()
|
||||
};
|
||||
|
||||
let data = Data::new(opt.clone()).unwrap();
|
||||
let data = Data::new(opt).unwrap();
|
||||
|
||||
Server {
|
||||
uid: uid.to_string(),
|
||||
@ -164,7 +164,7 @@ impl Server {
|
||||
|
||||
let req = test::TestRequest::get().uri(url).to_request();
|
||||
let res = test::call_service(&mut app, req).await;
|
||||
let status_code = res.status().clone();
|
||||
let status_code = res.status();
|
||||
|
||||
let body = test::read_body(res).await;
|
||||
let response = serde_json::from_slice(&body).unwrap_or_default();
|
||||
@ -182,7 +182,7 @@ impl Server {
|
||||
.set_json(&body)
|
||||
.to_request();
|
||||
let res = test::call_service(&mut app, req).await;
|
||||
let status_code = res.status().clone();
|
||||
let status_code = res.status();
|
||||
|
||||
let body = test::read_body(res).await;
|
||||
let response = serde_json::from_slice(&body).unwrap_or_default();
|
||||
@ -211,7 +211,7 @@ impl Server {
|
||||
.set_json(&body)
|
||||
.to_request();
|
||||
let res = test::call_service(&mut app, req).await;
|
||||
let status_code = res.status().clone();
|
||||
let status_code = res.status();
|
||||
|
||||
let body = test::read_body(res).await;
|
||||
let response = serde_json::from_slice(&body).unwrap_or_default();
|
||||
@ -237,7 +237,7 @@ impl Server {
|
||||
|
||||
let req = test::TestRequest::delete().uri(url).to_request();
|
||||
let res = test::call_service(&mut app, req).await;
|
||||
let status_code = res.status().clone();
|
||||
let status_code = res.status();
|
||||
|
||||
let body = test::read_body(res).await;
|
||||
let response = serde_json::from_slice(&body).unwrap_or_default();
|
||||
|
@ -77,7 +77,7 @@ async fn trigger_dump_twice_should_return_conflict() {
|
||||
let (value, status_code) = server.trigger_dump().await;
|
||||
|
||||
|
||||
assert_json_eq!(expected.clone(), value.clone(), ordered: false);
|
||||
assert_json_eq!(expected, value, ordered: false);
|
||||
assert_eq!(status_code, 409);
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ async fn trigger_dump_concurently_should_return_conflict() {
|
||||
|
||||
let ((_value_1, _status_code_1), (value_2, status_code_2)) = futures::join!(server.trigger_dump(), server.trigger_dump());
|
||||
|
||||
assert_json_eq!(expected.clone(), value_2.clone(), ordered: false);
|
||||
assert_json_eq!(expected, value_2, ordered: false);
|
||||
assert_eq!(status_code_2, 409);
|
||||
}
|
||||
|
||||
@ -121,7 +121,7 @@ async fn get_dump_status_early_should_return_in_progress() {
|
||||
|
||||
assert_eq!(status_code, 200);
|
||||
|
||||
assert_json_eq!(expected.clone(), value.clone(), ordered: false);
|
||||
assert_json_eq!(expected, value, ordered: false);
|
||||
}
|
||||
|
||||
#[actix_rt::test]
|
||||
@ -147,7 +147,7 @@ async fn get_dump_status_should_return_done() {
|
||||
|
||||
assert_eq!(status_code, 200);
|
||||
|
||||
assert_json_eq!(expected.clone(), value.clone(), ordered: false);
|
||||
assert_json_eq!(expected, value, ordered: false);
|
||||
}
|
||||
|
||||
#[actix_rt::test]
|
||||
@ -180,7 +180,7 @@ async fn get_dump_status_should_return_error_provoking_it() {
|
||||
|
||||
assert_eq!(status_code, 200);
|
||||
|
||||
assert_json_eq!(expected.clone(), value.clone(), ordered: false);
|
||||
assert_json_eq!(expected, value, ordered: false);
|
||||
}
|
||||
|
||||
#[actix_rt::test]
|
||||
@ -228,7 +228,7 @@ async fn dump_metadata_should_be_valid() {
|
||||
"dumpVersion": current_dump_version()
|
||||
});
|
||||
|
||||
assert_json_include!(expected: expected.clone(), actual: metadata.clone());
|
||||
assert_json_include!(expected: expected, actual: metadata);
|
||||
}
|
||||
|
||||
#[actix_rt::test]
|
||||
@ -321,7 +321,7 @@ async fn dump_index_settings_should_be_valid() {
|
||||
let file = File::open(tmp_dir_path.join("test").join("settings.json")).unwrap();
|
||||
let settings: serde_json::Value = serde_json::from_reader(file).unwrap();
|
||||
|
||||
assert_json_eq!(expected.clone(), settings.clone(), ordered: false);
|
||||
assert_json_eq!(expected, settings, ordered: false);
|
||||
}
|
||||
|
||||
#[actix_rt::test]
|
||||
@ -345,7 +345,7 @@ async fn dump_index_documents_should_be_valid() {
|
||||
let file = File::open(tmp_dir_path.join("test").join("documents.jsonl")).unwrap();
|
||||
let documents = read_all_jsonline(file);
|
||||
|
||||
assert_json_eq!(expected.clone(), documents.clone(), ordered: false);
|
||||
assert_json_eq!(expected, documents, ordered: false);
|
||||
}
|
||||
|
||||
#[actix_rt::test]
|
||||
@ -381,7 +381,7 @@ async fn dump_index_updates_should_be_valid() {
|
||||
|
||||
eprintln!("{}\n", updates.to_string());
|
||||
eprintln!("{}", expected.to_string());
|
||||
assert_json_include!(expected: expected.clone(), actual: updates.clone());
|
||||
assert_json_include!(expected: expected, actual: updates);
|
||||
}
|
||||
|
||||
#[actix_rt::test]
|
||||
|
@ -37,14 +37,8 @@ async fn placeholder_search_with_offset() {
|
||||
assert_eq!(status_code, 200);
|
||||
// take results at offset 3 as reference
|
||||
let lock = expected.lock().unwrap();
|
||||
lock.replace(
|
||||
response["hits"].as_array().unwrap()[3..6]
|
||||
.iter()
|
||||
.cloned()
|
||||
.collect(),
|
||||
);
|
||||
lock.replace(response["hits"].as_array().unwrap()[3..6].to_vec());
|
||||
});
|
||||
|
||||
let expected = expected.into_inner().unwrap().into_inner();
|
||||
|
||||
let query = json!({
|
||||
|
@ -130,13 +130,13 @@ async fn search_unexpected_params() {
|
||||
|
||||
let expected = "unknown field `lol`, expected one of `q`, `offset`, `limit`, `attributesToRetrieve`, `attributesToCrop`, `cropLength`, `attributesToHighlight`, `filters`, `matches`, `facetFilters`, `facetsDistribution` at line 1 column 6";
|
||||
|
||||
let post_query = serde_json::from_str::<meilisearch_http::routes::search::SearchQueryPost>(&query.clone().to_string());
|
||||
let post_query = serde_json::from_str::<meilisearch_http::routes::search::SearchQueryPost>(&query.to_string());
|
||||
assert!(post_query.is_err());
|
||||
assert_eq!(expected.clone(), post_query.err().unwrap().to_string());
|
||||
assert_eq!(expected, post_query.err().unwrap().to_string());
|
||||
|
||||
let get_query: Result<meilisearch_http::routes::search::SearchQuery, _> = serde_json::from_str(&query.clone().to_string());
|
||||
let get_query: Result<meilisearch_http::routes::search::SearchQuery, _> = serde_json::from_str(&query.to_string());
|
||||
assert!(get_query.is_err());
|
||||
assert_eq!(expected.clone(), get_query.err().unwrap().to_string());
|
||||
assert_eq!(expected, get_query.err().unwrap().to_string());
|
||||
}
|
||||
|
||||
#[actix_rt::test]
|
||||
|
Loading…
x
Reference in New Issue
Block a user