diff --git a/crates/meilisearch/src/option_test.rs b/crates/meilisearch/src/option_test.rs index 1fdb06718..80d21dad3 100644 --- a/crates/meilisearch/src/option_test.rs +++ b/crates/meilisearch/src/option_test.rs @@ -1,6 +1,7 @@ -use crate::option::Opt; use clap::Parser; +use crate::option::Opt; + #[test] fn test_valid_opt() { assert!(Opt::try_parse_from(Some("")).is_ok()); diff --git a/crates/meilisearch/tests/auth/tenant_token.rs b/crates/meilisearch/tests/auth/tenant_token.rs index 6bdb0c50f..a3f89e70b 100644 --- a/crates/meilisearch/tests/auth/tenant_token.rs +++ b/crates/meilisearch/tests/auth/tenant_token.rs @@ -146,7 +146,7 @@ macro_rules! compute_forbidden_search { server.use_admin_key("MASTER_KEY").await; let index = server.index("sales"); let documents = DOCUMENTS.clone(); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); drop(index); diff --git a/crates/meilisearch/tests/batches/mod.rs b/crates/meilisearch/tests/batches/mod.rs index e8dd9b6e3..92cc2008e 100644 --- a/crates/meilisearch/tests/batches/mod.rs +++ b/crates/meilisearch/tests/batches/mod.rs @@ -11,7 +11,7 @@ use crate::json; async fn error_get_unexisting_batch_status() { let server = Server::new().await; let index = server.index("test"); - let (task,_coder) = index.create(None).await; + let (task, _coder) = index.create(None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = index.get_batch(1).await; @@ -40,7 +40,7 @@ async fn get_batch_status() { async fn list_batches() { let server = Server::new().await; let index = server.index("test"); - let (task,_status_code) = index.create(None).await; + let (task, _status_code) = index.create(None).await; index.wait_task(task.uid()).await.succeeded(); index .add_documents(serde_json::from_str(include_str!("../assets/test_set.json")).unwrap(), None) @@ -142,9 +142,9 @@ async fn list_batches_with_star_filters() { async fn list_batches_status_filtered() { let server = Server::new().await; let index = server.index("test"); - let (task,_status_code) = index.create(None).await; + let (task, _status_code) = index.create(None).await; index.wait_task(task.uid()).await.succeeded(); - let (task,_status_code) = index + let (task, _status_code) = index .add_documents(serde_json::from_str(include_str!("../assets/test_set.json")).unwrap(), None) .await; @@ -168,7 +168,7 @@ async fn list_batches_status_filtered() { async fn list_batches_type_filtered() { let server = Server::new().await; let index = server.index("test"); - let (task,_status_code) = index.create(None).await; + let (task, _status_code) = index.create(None).await; index.wait_task(task.uid()).await.succeeded(); index .add_documents(serde_json::from_str(include_str!("../assets/test_set.json")).unwrap(), None) @@ -188,7 +188,7 @@ async fn list_batches_type_filtered() { async fn list_batches_invalid_canceled_by_filter() { let server = Server::new().await; let index = server.index("test"); - let (task,_status_code) = index.create(None).await; + let (task, _status_code) = index.create(None).await; index.wait_task(task.uid()).await.succeeded(); index .add_documents(serde_json::from_str(include_str!("../assets/test_set.json")).unwrap(), None) @@ -203,7 +203,7 @@ async fn list_batches_invalid_canceled_by_filter() { async fn list_batches_status_and_type_filtered() { let server = Server::new().await; let index = server.index("test"); - let (task,_status_code) = index.create(None).await; + let (task, _status_code) = index.create(None).await; index.wait_task(task.uid()).await.succeeded(); index .add_documents(serde_json::from_str(include_str!("../assets/test_set.json")).unwrap(), None) @@ -277,7 +277,8 @@ async fn list_batch_filter_error() { async fn test_summarized_document_addition_or_update() { let server = Server::new().await; let index = server.index("test"); - let (task,_status_code) = index.add_documents(json!({ "id": 42, "content": "doggos & fluff" }), None).await; + let (task, _status_code) = + index.add_documents(json!({ "id": 42, "content": "doggos & fluff" }), None).await; index.wait_task(task.uid()).await.succeeded(); let (batch, _) = index.get_batch(0).await; assert_json_snapshot!(batch, @@ -308,7 +309,8 @@ async fn test_summarized_document_addition_or_update() { } "#); - let (task,_status_code) = index.add_documents(json!({ "id": 42, "content": "doggos & fluff" }), Some("id")).await; + let (task, _status_code) = + index.add_documents(json!({ "id": 42, "content": "doggos & fluff" }), Some("id")).await; index.wait_task(task.uid()).await.succeeded(); let (batch, _) = index.get_batch(1).await; assert_json_snapshot!(batch, @@ -344,7 +346,7 @@ async fn test_summarized_document_addition_or_update() { async fn test_summarized_delete_documents_by_batch() { let server = Server::new().await; let index = server.index("test"); - let (task,_status_code) = index.delete_batch(vec![1, 2, 3]).await; + let (task, _status_code) = index.delete_batch(vec![1, 2, 3]).await; index.wait_task(task.uid()).await.succeeded(); let (batch, _) = index.get_batch(0).await; assert_json_snapshot!(batch, @@ -376,7 +378,7 @@ async fn test_summarized_delete_documents_by_batch() { "#); index.create(None).await; - let (task,_status_code) = index.delete_batch(vec![42]).await; + let (task, _status_code) = index.delete_batch(vec![42]).await; index.wait_task(task.uid()).await.succeeded(); let (batch, _) = index.get_batch(2).await; assert_json_snapshot!(batch, @@ -413,7 +415,8 @@ async fn test_summarized_delete_documents_by_filter() { let server = Server::new().await; let index = server.index("test"); - let (task,_status_code) = index.delete_document_by_filter(json!({ "filter": "doggo = bernese" })).await; + let (task, _status_code) = + index.delete_document_by_filter(json!({ "filter": "doggo = bernese" })).await; index.wait_task(task.uid()).await.succeeded(); let (batch, _) = index.get_batch(0).await; assert_json_snapshot!(batch, @@ -446,7 +449,8 @@ async fn test_summarized_delete_documents_by_filter() { "#); index.create(None).await; - let (task,_status_code) = index.delete_document_by_filter(json!({ "filter": "doggo = bernese" })).await; + let (task, _status_code) = + index.delete_document_by_filter(json!({ "filter": "doggo = bernese" })).await; index.wait_task(task.uid()).await.succeeded(); let (batch, _) = index.get_batch(2).await; assert_json_snapshot!(batch, @@ -479,7 +483,8 @@ async fn test_summarized_delete_documents_by_filter() { "#); index.update_settings(json!({ "filterableAttributes": ["doggo"] })).await; - let (task,_status_code) = index.delete_document_by_filter(json!({ "filter": "doggo = bernese" })).await; + let (task, _status_code) = + index.delete_document_by_filter(json!({ "filter": "doggo = bernese" })).await; index.wait_task(task.uid()).await.succeeded(); let (batch, _) = index.get_batch(4).await; assert_json_snapshot!(batch, @@ -516,7 +521,7 @@ async fn test_summarized_delete_documents_by_filter() { async fn test_summarized_delete_document_by_id() { let server = Server::new().await; let index = server.index("test"); - let (task,_status_code) = index.delete_document(1).await; + let (task, _status_code) = index.delete_document(1).await; index.wait_task(task.uid()).await.succeeded(); let (batch, _) = index.get_batch(0).await; assert_json_snapshot!(batch, @@ -548,7 +553,7 @@ async fn test_summarized_delete_document_by_id() { "#); index.create(None).await; - let (task,_status_code) = index.delete_document(42).await; + let (task, _status_code) = index.delete_document(42).await; index.wait_task(task.uid()).await.succeeded(); let (batch, _) = index.get_batch(2).await; assert_json_snapshot!(batch, @@ -641,7 +646,7 @@ async fn test_summarized_settings_update() { async fn test_summarized_index_creation() { let server = Server::new().await; let index = server.index("test"); - let (task,_status_code) = index.create(None).await; + let (task, _status_code) = index.create(None).await; index.wait_task(task.uid()).await.succeeded(); let (batch, _) = index.get_batch(0).await; assert_json_snapshot!(batch, @@ -669,7 +674,7 @@ async fn test_summarized_index_creation() { } "#); - let (task,_status_code) = index.create(Some("doggos")).await; + let (task, _status_code) = index.create(Some("doggos")).await; index.wait_task(task.uid()).await.succeeded(); let (batch, _) = index.get_batch(1).await; assert_json_snapshot!(batch, @@ -814,7 +819,7 @@ async fn test_summarized_index_update() { let server = Server::new().await; let index = server.index("test"); // If the index doesn't exist yet, we should get errors with or without the primary key. - let (task,_status_code) = index.update(None).await; + let (task, _status_code) = index.update(None).await; index.wait_task(task.uid()).await.succeeded(); let (batch, _) = index.get_batch(0).await; assert_json_snapshot!(batch, @@ -842,7 +847,7 @@ async fn test_summarized_index_update() { } "#); - let (task,_status_code) = index.update(Some("bones")).await; + let (task, _status_code) = index.update(Some("bones")).await; index.wait_task(task.uid()).await.succeeded(); let (batch, _) = index.get_batch(1).await; assert_json_snapshot!(batch, @@ -875,7 +880,7 @@ async fn test_summarized_index_update() { // And run the same two tests once the index do exists. index.create(None).await; - let (task,_status_code) = index.update(None).await; + let (task, _status_code) = index.update(None).await; index.wait_task(task.uid()).await.succeeded(); let (batch, _) = index.get_batch(3).await; assert_json_snapshot!(batch, @@ -903,7 +908,7 @@ async fn test_summarized_index_update() { } "#); - let (task,_status_code) = index.update(Some("bones")).await; + let (task, _status_code) = index.update(Some("bones")).await; index.wait_task(task.uid()).await.succeeded(); let (batch, _) = index.get_batch(4).await; assert_json_snapshot!(batch, @@ -937,7 +942,7 @@ async fn test_summarized_index_update() { #[actix_web::test] async fn test_summarized_index_swap() { let server = Server::new().await; - let (task,_status_code) = server + let (task, _status_code) = server .index_swap(json!([ { "indexes": ["doggos", "cattos"] } ])) @@ -977,7 +982,7 @@ async fn test_summarized_index_swap() { "#); server.index("doggos").create(None).await; - let (task,_status_code) = server.index("cattos").create(None).await; + let (task, _status_code) = server.index("cattos").create(None).await; server .index_swap(json!([ { "indexes": ["doggos", "cattos"] } @@ -1023,9 +1028,9 @@ async fn test_summarized_batch_cancelation() { let server = Server::new().await; let index = server.index("doggos"); // to avoid being flaky we're only going to cancel an already finished batch :( - let (task,_status_code) = index.create(None).await; + let (task, _status_code) = index.create(None).await; index.wait_task(task.uid()).await.succeeded(); - let (task,_status_code) = server.cancel_tasks("uids=0").await; + let (task, _status_code) = server.cancel_tasks("uids=0").await; index.wait_task(task.uid()).await.succeeded(); //TODO: create a get_batch function interface that accepts u64, and remove the following cast. let (batch, _) = index.get_batch(task.uid().to_u32().unwrap()).await; @@ -1062,9 +1067,9 @@ async fn test_summarized_batch_deletion() { let server = Server::new().await; let index = server.index("doggos"); // to avoid being flaky we're only going to delete an already finished batch :( - let (task,_status_code) = index.create(None).await; + let (task, _status_code) = index.create(None).await; index.wait_task(task.uid()).await.succeeded(); - let (task,_status_code) = server.delete_tasks("uids=0").await; + let (task, _status_code) = server.delete_tasks("uids=0").await; index.wait_task(task.uid()).await.succeeded(); let (batch, _) = index.get_batch(1).await; assert_json_snapshot!(batch, @@ -1098,7 +1103,7 @@ async fn test_summarized_batch_deletion() { #[actix_web::test] async fn test_summarized_dump_creation() { let server = Server::new().await; - let (task,_status_code) = server.create_dump().await; + let (task, _status_code) = server.create_dump().await; server.wait_task(task.uid()).await; let (batch, _) = server.get_batch(0).await; assert_json_snapshot!(batch, diff --git a/crates/meilisearch/tests/documents/add_documents.rs b/crates/meilisearch/tests/documents/add_documents.rs index aa3d3fbf7..688ebccb1 100644 --- a/crates/meilisearch/tests/documents/add_documents.rs +++ b/crates/meilisearch/tests/documents/add_documents.rs @@ -1274,7 +1274,7 @@ async fn error_add_documents_bad_document_id() { "content": "foobar" } ]); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = index.get_task(1).await; snapshot!(code, @"200 OK"); @@ -1390,7 +1390,7 @@ async fn error_add_documents_missing_document_id() { "content": "foobar" } ]); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = index.get_task(1).await; snapshot!(code, @"200 OK"); @@ -1702,7 +1702,7 @@ async fn add_documents_with_geo_field() { }, ]); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; let response = index.wait_task(task.uid()).await; snapshot!(json_string!(response, { ".duration" => "[duration]", ".enqueuedAt" => "[date]", ".startedAt" => "[date]", ".finishedAt" => "[date]" }), @r###" @@ -1741,7 +1741,7 @@ async fn add_documents_invalid_geo_field() { } ]); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = index.get_task(2).await; snapshot!(code, @"200 OK"); @@ -1779,7 +1779,7 @@ async fn add_documents_invalid_geo_field() { } ]); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = index.get_task(3).await; snapshot!(code, @"200 OK"); @@ -1817,7 +1817,7 @@ async fn add_documents_invalid_geo_field() { } ]); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = index.get_task(4).await; snapshot!(code, @"200 OK"); @@ -1855,7 +1855,7 @@ async fn add_documents_invalid_geo_field() { } ]); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = index.get_task(task.uid()).await; snapshot!(code, @"200 OK"); @@ -1893,7 +1893,7 @@ async fn add_documents_invalid_geo_field() { } ]); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = index.get_task(task.uid()).await; snapshot!(code, @"200 OK"); @@ -1931,7 +1931,7 @@ async fn add_documents_invalid_geo_field() { } ]); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = index.get_task(task.uid()).await; snapshot!(code, @"200 OK"); @@ -1969,7 +1969,7 @@ async fn add_documents_invalid_geo_field() { } ]); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = index.get_task(task.uid()).await; snapshot!(code, @"200 OK"); @@ -2007,7 +2007,7 @@ async fn add_documents_invalid_geo_field() { } ]); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = index.get_task(task.uid()).await; snapshot!(code, @"200 OK"); @@ -2045,7 +2045,7 @@ async fn add_documents_invalid_geo_field() { } ]); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = index.get_task(task.uid()).await; snapshot!(code, @"200 OK"); @@ -2083,7 +2083,7 @@ async fn add_documents_invalid_geo_field() { } ]); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = index.get_task(task.uid()).await; snapshot!(code, @"200 OK"); @@ -2121,7 +2121,7 @@ async fn add_documents_invalid_geo_field() { } ]); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = index.get_task(task.uid()).await; snapshot!(code, @"200 OK"); @@ -2159,7 +2159,7 @@ async fn add_documents_invalid_geo_field() { } ]); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = index.get_task(task.uid()).await; snapshot!(code, @"200 OK"); @@ -2409,7 +2409,7 @@ async fn error_primary_key_inference() { } ]); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = index.get_task(0).await; assert_eq!(code, 200); @@ -2450,7 +2450,7 @@ async fn error_primary_key_inference() { } ]); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = index.get_task(task.uid()).await; assert_eq!(code, 200); @@ -2489,7 +2489,7 @@ async fn error_primary_key_inference() { } ]); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = index.get_task(task.uid()).await; assert_eq!(code, 200); @@ -2528,12 +2528,12 @@ async fn add_documents_with_primary_key_twice() { } ]); - let (task,_status_code) = index.add_documents(documents.clone(), Some("title")).await; + let (task, _status_code) = index.add_documents(documents.clone(), Some("title")).await; index.wait_task(task.uid()).await.succeeded(); let (response, _code) = index.get_task(task.uid()).await; assert_eq!(response["status"], "succeeded"); - let (task,_status_code) = index.add_documents(documents, Some("title")).await; + let (task, _status_code) = index.add_documents(documents, Some("title")).await; index.wait_task(task.uid()).await.succeeded(); let (response, _code) = index.get_task(task.uid()).await; assert_eq!(response["status"], "succeeded"); diff --git a/crates/meilisearch/tests/documents/delete_documents.rs b/crates/meilisearch/tests/documents/delete_documents.rs index aba3824c5..d9cd3004a 100644 --- a/crates/meilisearch/tests/documents/delete_documents.rs +++ b/crates/meilisearch/tests/documents/delete_documents.rs @@ -30,9 +30,10 @@ async fn delete_one_unexisting_document() { async fn delete_one_document() { let server = Server::new().await; let index = server.index("test"); - let (task,_status_code) = index.add_documents(json!([{ "id": 0, "content": "foobar" }]), None).await; + let (task, _status_code) = + index.add_documents(json!([{ "id": 0, "content": "foobar" }]), None).await; index.wait_task(task.uid()).await.succeeded(); - let (task,status_code) = server.index("test").delete_document(0).await; + let (task, status_code) = server.index("test").delete_document(0).await; assert_eq!(status_code, 202); index.wait_task(task.uid()).await.succeeded(); @@ -56,7 +57,7 @@ async fn clear_all_documents_unexisting_index() { async fn clear_all_documents() { let server = Server::new().await; let index = server.index("test"); - let (task,_status_code) = index + let (task, _status_code) = index .add_documents( json!([{ "id": 1, "content": "foobar" }, { "id": 0, "content": "foobar" }]), None, @@ -76,7 +77,7 @@ async fn clear_all_documents() { async fn clear_all_documents_empty_index() { let server = Server::new().await; let index = server.index("test"); - let (task,_status_code) = index.create(None).await; + let (task, _status_code) = index.create(None).await; index.wait_task(task.uid()).await.succeeded(); let (task, code) = index.clear_all_documents().await; assert_eq!(code, 202); @@ -143,7 +144,7 @@ async fn delete_document_by_filter() { let server = Server::new().await; let index = server.index("doggo"); index.update_settings_filterable_attributes(json!(["color"])).await; - let (task,_status_code) = index + let (task, _status_code) = index .add_documents( json!([ { "id": 0, "color": "red" }, @@ -303,7 +304,7 @@ async fn delete_document_by_complex_filter() { let server = Server::new().await; let index = server.index("doggo"); index.update_settings_filterable_attributes(json!(["color"])).await; - let (task,_status_code) = index + let (task, _status_code) = index .add_documents( json!([ { "id": 0, "color": "red" }, diff --git a/crates/meilisearch/tests/index/get_index.rs b/crates/meilisearch/tests/index/get_index.rs index 16c9dcd0e..40c4fc127 100644 --- a/crates/meilisearch/tests/index/get_index.rs +++ b/crates/meilisearch/tests/index/get_index.rs @@ -55,7 +55,7 @@ async fn no_index_return_empty_list() { async fn list_multiple_indexes() { let server = Server::new().await; server.index("test").create(None).await; - let (task,_status_code) = server.index("test1").create(Some("key")).await; + let (task, _status_code) = server.index("test1").create(Some("key")).await; server.index("test").wait_task(task.uid()).await.succeeded(); diff --git a/crates/meilisearch/tests/index/update_index.rs b/crates/meilisearch/tests/index/update_index.rs index 0430cee34..a9b02e7d4 100644 --- a/crates/meilisearch/tests/index/update_index.rs +++ b/crates/meilisearch/tests/index/update_index.rs @@ -13,7 +13,7 @@ async fn update_primary_key() { assert_eq!(code, 202); - let (task,_status_code) = index.update(Some("primary")).await; + let (task, _status_code) = index.update(Some("primary")).await; let response = index.wait_task(task.uid()).await; @@ -46,7 +46,7 @@ async fn create_and_update_with_different_encoding() { assert_eq!(code, 202); let index = server.index_with_encoder("test", Encoder::Brotli); - let (task,_status_code) = index.update(Some("primary")).await; + let (task, _status_code) = index.update(Some("primary")).await; let response = index.wait_task(task.uid()).await; diff --git a/crates/meilisearch/tests/search/distinct.rs b/crates/meilisearch/tests/search/distinct.rs index 968cc58a1..094ef7bbf 100644 --- a/crates/meilisearch/tests/search/distinct.rs +++ b/crates/meilisearch/tests/search/distinct.rs @@ -151,7 +151,7 @@ async fn distinct_search_with_offset_no_ranking() { let documents = DOCUMENTS.clone(); index.add_documents(documents, Some(DOCUMENT_PRIMARY_KEY)).await; - let (task,_status_code) = index.update_distinct_attribute(json!(DOCUMENT_DISTINCT_KEY)).await; + let (task, _status_code) = index.update_distinct_attribute(json!(DOCUMENT_DISTINCT_KEY)).await; index.wait_task(task.uid()).await.succeeded(); fn get_hits(response: &Value) -> Vec<&str> { @@ -210,7 +210,7 @@ async fn distinct_search_with_pagination_no_ranking() { let documents = DOCUMENTS.clone(); index.add_documents(documents, Some(DOCUMENT_PRIMARY_KEY)).await; - let (task,_status_code) = index.update_distinct_attribute(json!(DOCUMENT_DISTINCT_KEY)).await; + let (task, _status_code) = index.update_distinct_attribute(json!(DOCUMENT_DISTINCT_KEY)).await; index.wait_task(task.uid()).await.succeeded(); fn get_hits(response: &Value) -> Vec<&str> { diff --git a/crates/meilisearch/tests/search/facet_search.rs b/crates/meilisearch/tests/search/facet_search.rs index eb71987c4..7e46c5d15 100644 --- a/crates/meilisearch/tests/search/facet_search.rs +++ b/crates/meilisearch/tests/search/facet_search.rs @@ -41,7 +41,7 @@ async fn simple_facet_search() { let documents = DOCUMENTS.clone(); index.update_settings_filterable_attributes(json!(["genres"])).await; - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = @@ -175,7 +175,7 @@ async fn advanced_facet_search() { let documents = DOCUMENTS.clone(); index.update_settings_filterable_attributes(json!(["genres"])).await; index.update_settings_typo_tolerance(json!({ "enabled": false })).await; - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = @@ -199,7 +199,7 @@ async fn more_advanced_facet_search() { let documents = DOCUMENTS.clone(); index.update_settings_filterable_attributes(json!(["genres"])).await; index.update_settings_typo_tolerance(json!({ "disableOnWords": ["adventre"] })).await; - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = @@ -223,7 +223,7 @@ async fn simple_facet_search_with_max_values() { let documents = DOCUMENTS.clone(); index.update_settings_faceting(json!({ "maxValuesPerFacet": 1 })).await; index.update_settings_filterable_attributes(json!(["genres"])).await; - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = @@ -245,7 +245,7 @@ async fn simple_facet_search_by_count_with_max_values() { ) .await; index.update_settings_filterable_attributes(json!(["genres"])).await; - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = @@ -261,7 +261,7 @@ async fn non_filterable_facet_search_error() { let index = server.index("test"); let documents = DOCUMENTS.clone(); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = @@ -280,7 +280,7 @@ async fn facet_search_dont_support_words() { let documents = DOCUMENTS.clone(); index.update_settings_filterable_attributes(json!(["genres"])).await; - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = @@ -298,7 +298,7 @@ async fn simple_facet_search_with_sort_by_count() { let documents = DOCUMENTS.clone(); index.update_settings_faceting(json!({ "sortFacetValuesBy": { "*": "count" } })).await; index.update_settings_filterable_attributes(json!(["genres"])).await; - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = diff --git a/crates/meilisearch/tests/search/geo.rs b/crates/meilisearch/tests/search/geo.rs index d304e940e..b0cc8b6ca 100644 --- a/crates/meilisearch/tests/search/geo.rs +++ b/crates/meilisearch/tests/search/geo.rs @@ -46,7 +46,7 @@ async fn geo_sort_with_geo_strings() { let documents = DOCUMENTS.clone(); index.update_settings_filterable_attributes(json!(["_geo"])).await; index.update_settings_sortable_attributes(json!(["_geo"])).await; - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); index diff --git a/crates/meilisearch/tests/search/locales.rs b/crates/meilisearch/tests/search/locales.rs index 3e7ce5763..282589d6a 100644 --- a/crates/meilisearch/tests/search/locales.rs +++ b/crates/meilisearch/tests/search/locales.rs @@ -98,7 +98,7 @@ async fn simple_search() { json!({"searchableAttributes": ["name_en", "name_ja", "name_zh", "author_en", "author_ja", "author_zh", "description_en", "description_ja", "description_zh"]}), ) .await; - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); // english @@ -220,7 +220,7 @@ async fn force_locales() { "enqueuedAt": "[date]" } "###); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); // chinese detection @@ -298,7 +298,7 @@ async fn force_locales_with_pattern() { "enqueuedAt": "[date]" } "###); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); // chinese detection @@ -374,7 +374,7 @@ async fn force_locales_with_pattern_nested() { "enqueuedAt": "[date]" } "###); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); // chinese @@ -449,7 +449,7 @@ async fn force_different_locales_with_pattern() { "enqueuedAt": "[date]" } "###); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); // force chinese @@ -527,7 +527,7 @@ async fn auto_infer_locales_at_search_with_attributes_to_search_on() { "enqueuedAt": "[date]" } "###); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); // auto infer any language @@ -601,7 +601,7 @@ async fn auto_infer_locales_at_search() { "enqueuedAt": "[date]" } "###); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); index @@ -700,7 +700,7 @@ async fn force_different_locales_with_pattern_nested() { "enqueuedAt": "[date]" } "###); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); // chinese @@ -778,7 +778,7 @@ async fn settings_change() { let index = server.index("test"); let documents = NESTED_DOCUMENTS.clone(); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, _) = index .update_settings(json!({ @@ -915,7 +915,7 @@ async fn invalid_locales() { json!({"searchableAttributes": ["name_en", "name_ja", "name_zh", "author_en", "author_ja", "author_zh", "description_en", "description_ja", "description_zh"]}), ) .await; - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = index.search_post(json!({"q": "Atta", "locales": ["invalid"]})).await; @@ -1033,7 +1033,7 @@ async fn simple_facet_search() { "enqueuedAt": "[date]" } "###); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, _) = index @@ -1095,7 +1095,7 @@ async fn facet_search_with_localized_attributes() { "enqueuedAt": "[date]" } "###); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, _) = index diff --git a/crates/meilisearch/tests/search/matching_strategy.rs b/crates/meilisearch/tests/search/matching_strategy.rs index 37004569b..3b4325c10 100644 --- a/crates/meilisearch/tests/search/matching_strategy.rs +++ b/crates/meilisearch/tests/search/matching_strategy.rs @@ -8,7 +8,7 @@ use crate::json; async fn index_with_documents<'a>(server: &'a Server, documents: &Value) -> Index<'a> { let index = server.index("test"); - let(task,_status_code) =index.add_documents(documents.clone(), None).await; + let (task, _status_code) = index.add_documents(documents.clone(), None).await; index.wait_task(task.uid()).await.succeeded(); index } diff --git a/crates/meilisearch/tests/search/mod.rs b/crates/meilisearch/tests/search/mod.rs index ccf7a7946..0046964fa 100644 --- a/crates/meilisearch/tests/search/mod.rs +++ b/crates/meilisearch/tests/search/mod.rs @@ -138,7 +138,7 @@ async fn phrase_search_with_stop_word() { meili_snap::snapshot!(code, @"202 Accepted"); let documents = DOCUMENTS.clone(); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); index @@ -218,10 +218,11 @@ async fn negative_special_cases_search() { let index = server.index("test"); let documents = DOCUMENTS.clone(); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); - let (task,_status_code) = index.update_settings(json!({"synonyms": { "escape": ["gläss"] }})).await; + let (task, _status_code) = + index.update_settings(json!({"synonyms": { "escape": ["gläss"] }})).await; index.wait_task(task.uid()).await.succeeded(); // There is a synonym for escape -> glass but we don't want "escape", only the derivates: glass @@ -247,7 +248,7 @@ async fn test_kanji_language_detection() { { "id": 1, "title": "東京のお寿司。" }, { "id": 2, "title": "הַשּׁוּעָל הַמָּהִיר (״הַחוּם״) לֹא יָכוֹל לִקְפֹּץ 9.94 מֶטְרִים, נָכוֹן? ברר, 1.5°C- בַּחוּץ!" } ]); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); index @@ -270,10 +271,10 @@ async fn test_thai_language() { { "id": 1, "title": "สบู่สมุนไพรชาเขียว 100 กรัม จำนวน 6 ก้อน" }, { "id": 2, "title": "สบู่สมุนไพรฝางแดงผสมว่านหางจรเข้ 100 กรัม จำนวน 6 ก้อน" } ]); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); - let (task,_status_code) = index.update_settings(json!({"rankingRules": ["exactness"]})).await; + let (task, _status_code) = index.update_settings(json!({"rankingRules": ["exactness"]})).await; index.wait_task(task.uid()).await.succeeded(); index @@ -607,7 +608,7 @@ async fn displayed_attributes() { index.update_settings(json!({ "displayedAttributes": ["title"] })).await; let documents = DOCUMENTS.clone(); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = @@ -622,7 +623,7 @@ async fn placeholder_search_is_hard_limited() { let index = server.index("test"); let documents: Vec<_> = (0..1200).map(|i| json!({ "id": i, "text": "I am unique!" })).collect(); - let (task,_status_code) = index.add_documents(documents.into(), None).await; + let (task, _status_code) = index.add_documents(documents.into(), None).await; index.wait_task(task.uid()).await.succeeded(); index @@ -650,7 +651,8 @@ async fn placeholder_search_is_hard_limited() { ) .await; - let (task,_status_code) = index.update_settings(json!({ "pagination": { "maxTotalHits": 10_000 } })).await; + let (task, _status_code) = + index.update_settings(json!({ "pagination": { "maxTotalHits": 10_000 } })).await; index.wait_task(task.uid()).await.succeeded(); index @@ -685,7 +687,7 @@ async fn search_is_hard_limited() { let index = server.index("test"); let documents: Vec<_> = (0..1200).map(|i| json!({ "id": i, "text": "I am unique!" })).collect(); - let (task,_status_code) = index.add_documents(documents.into(), None).await; + let (task, _status_code) = index.add_documents(documents.into(), None).await; index.wait_task(task.uid()).await.succeeded(); index @@ -715,7 +717,8 @@ async fn search_is_hard_limited() { ) .await; - let (task,_status_code) = index.update_settings(json!({ "pagination": { "maxTotalHits": 10_000 } })).await; + let (task, _status_code) = + index.update_settings(json!({ "pagination": { "maxTotalHits": 10_000 } })).await; index.wait_task(task.uid()).await.succeeded(); index @@ -754,7 +757,7 @@ async fn faceting_max_values_per_facet() { index.update_settings(json!({ "filterableAttributes": ["number"] })).await; let documents: Vec<_> = (0..10_000).map(|id| json!({ "id": id, "number": id * 10 })).collect(); - let (task,_status_code) = index.add_documents(json!(documents), None).await; + let (task, _status_code) = index.add_documents(json!(documents), None).await; index.wait_task(task.uid()).await.succeeded(); index @@ -770,7 +773,8 @@ async fn faceting_max_values_per_facet() { ) .await; - let (task,_status_code) = index.update_settings(json!({ "faceting": { "maxValuesPerFacet": 10_000 } })).await; + let (task, _status_code) = + index.update_settings(json!({ "faceting": { "maxValuesPerFacet": 10_000 } })).await; index.wait_task(task.uid()).await.succeeded(); index @@ -1162,7 +1166,7 @@ async fn experimental_feature_vector_store() { let documents = DOCUMENTS.clone(); - let (task,_status_code) = index.add_documents(json!(documents), None).await; + let (task, _status_code) = index.add_documents(json!(documents), None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = index @@ -1369,7 +1373,7 @@ async fn camelcased_words() { { "id": 3, "title": "TestAb" }, { "id": 4, "title": "testab" }, ]); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); index @@ -1587,12 +1591,13 @@ async fn simple_search_with_strange_synonyms() { let server = Server::new().await; let index = server.index("test"); - let (task,_status_code) = index.update_settings(json!({ "synonyms": {"&": ["to"], "to": ["&"]} })).await; + let (task, _status_code) = + index.update_settings(json!({ "synonyms": {"&": ["to"], "to": ["&"]} })).await; let r = index.wait_task(task.uid()).await; meili_snap::snapshot!(r["status"], @r###""succeeded""###); let documents = DOCUMENTS.clone(); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); index @@ -1679,7 +1684,7 @@ async fn change_attributes_settings() { index.update_settings(json!({ "searchableAttributes": ["father", "mother"] })).await; let documents = NESTED_DOCUMENTS.clone(); - let (task,_status_code) = index.add_documents(json!(documents), None).await; + let (task, _status_code) = index.add_documents(json!(documents), None).await; index.wait_task(task.uid()).await.succeeded(); let (task,_status_code) = diff --git a/crates/meilisearch/tests/search/multi.rs b/crates/meilisearch/tests/search/multi.rs index 1ba297c11..5b0144d45 100644 --- a/crates/meilisearch/tests/search/multi.rs +++ b/crates/meilisearch/tests/search/multi.rs @@ -89,7 +89,7 @@ async fn simple_search_single_index() { let index = server.index("test"); let documents = DOCUMENTS.clone(); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = server @@ -161,7 +161,7 @@ async fn federation_single_search_single_index() { let index = server.index("test"); let documents = DOCUMENTS.clone(); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = server @@ -208,7 +208,7 @@ async fn federation_multiple_search_single_index() { let index = server.index("test"); let documents = SCORE_DOCUMENTS.clone(); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = server @@ -283,7 +283,7 @@ async fn federation_two_search_single_index() { let index = server.index("test"); let documents = DOCUMENTS.clone(); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = server @@ -351,7 +351,7 @@ async fn simple_search_missing_index_uid() { let index = server.index("test"); let documents = DOCUMENTS.clone(); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = server @@ -376,7 +376,7 @@ async fn federation_simple_search_missing_index_uid() { let index = server.index("test"); let documents = DOCUMENTS.clone(); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = server @@ -401,7 +401,7 @@ async fn simple_search_illegal_index_uid() { let index = server.index("test"); let documents = DOCUMENTS.clone(); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = server @@ -426,7 +426,7 @@ async fn federation_search_illegal_index_uid() { let index = server.index("test"); let documents = DOCUMENTS.clone(); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = server @@ -451,12 +451,12 @@ async fn simple_search_two_indexes() { let index = server.index("test"); let documents = DOCUMENTS.clone(); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let index = server.index("nested"); let documents = NESTED_DOCUMENTS.clone(); - let (add_task,_status_code) = index.add_documents(documents, None).await; + let (add_task, _status_code) = index.add_documents(documents, None).await; index.wait_task(add_task.uid()).await.succeeded(); let (response, code) = server @@ -558,12 +558,12 @@ async fn federation_two_search_two_indexes() { let index = server.index("test"); let documents = DOCUMENTS.clone(); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let index = server.index("nested"); let documents = NESTED_DOCUMENTS.clone(); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = server @@ -666,17 +666,17 @@ async fn federation_multiple_search_multiple_indexes() { let index = server.index("test"); let documents = DOCUMENTS.clone(); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let index = server.index("nested"); let documents = NESTED_DOCUMENTS.clone(); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let index = server.index("score"); let documents = SCORE_DOCUMENTS.clone(); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = server @@ -924,7 +924,7 @@ async fn search_one_index_doesnt_exist() { let index = server.index("test"); let documents = DOCUMENTS.clone(); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = server @@ -950,7 +950,7 @@ async fn federation_one_index_doesnt_exist() { let index = server.index("test"); let documents = DOCUMENTS.clone(); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = server @@ -1021,12 +1021,12 @@ async fn search_one_query_error() { let index = server.index("test"); let documents = DOCUMENTS.clone(); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let index = server.index("nested"); let documents = NESTED_DOCUMENTS.clone(); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = server @@ -1053,12 +1053,12 @@ async fn federation_one_query_error() { let index = server.index("test"); let documents = DOCUMENTS.clone(); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let index = server.index("nested"); let documents = NESTED_DOCUMENTS.clone(); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = server @@ -1085,12 +1085,12 @@ async fn federation_one_query_sort_error() { let index = server.index("test"); let documents = DOCUMENTS.clone(); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let index = server.index("nested"); let documents = NESTED_DOCUMENTS.clone(); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = server @@ -1117,12 +1117,12 @@ async fn search_multiple_query_errors() { let index = server.index("test"); let documents = DOCUMENTS.clone(); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let index = server.index("nested"); let documents = NESTED_DOCUMENTS.clone(); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = server @@ -1149,12 +1149,12 @@ async fn federation_multiple_query_errors() { let index = server.index("test"); let documents = DOCUMENTS.clone(); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let index = server.index("nested"); let documents = NESTED_DOCUMENTS.clone(); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = server @@ -1181,12 +1181,12 @@ async fn federation_multiple_query_sort_errors() { let index = server.index("test"); let documents = DOCUMENTS.clone(); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let index = server.index("nested"); let documents = NESTED_DOCUMENTS.clone(); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = server @@ -1213,12 +1213,12 @@ async fn federation_multiple_query_errors_interleaved() { let index = server.index("test"); let documents = DOCUMENTS.clone(); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let index = server.index("nested"); let documents = NESTED_DOCUMENTS.clone(); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = server @@ -1246,12 +1246,12 @@ async fn federation_multiple_query_sort_errors_interleaved() { let index = server.index("test"); let documents = DOCUMENTS.clone(); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let index = server.index("nested"); let documents = NESTED_DOCUMENTS.clone(); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = server @@ -3020,17 +3020,17 @@ async fn federation_limit_offset() { let index = server.index("test"); let documents = DOCUMENTS.clone(); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let index = server.index("nested"); let documents = NESTED_DOCUMENTS.clone(); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let index = server.index("score"); let documents = SCORE_DOCUMENTS.clone(); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); { let (response, code) = server @@ -3338,17 +3338,17 @@ async fn federation_formatting() { let index = server.index("test"); let documents = DOCUMENTS.clone(); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let index = server.index("nested"); let documents = NESTED_DOCUMENTS.clone(); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); let index = server.index("score"); let documents = SCORE_DOCUMENTS.clone(); - let (task,_status_code) = index.add_documents(documents, None).await; + let (task, _status_code) = index.add_documents(documents, None).await; index.wait_task(task.uid()).await.succeeded(); { let (response, code) = server diff --git a/crates/meilisearch/tests/search/restrict_searchable.rs b/crates/meilisearch/tests/search/restrict_searchable.rs index 0a119f912..600adc0de 100644 --- a/crates/meilisearch/tests/search/restrict_searchable.rs +++ b/crates/meilisearch/tests/search/restrict_searchable.rs @@ -65,7 +65,7 @@ async fn search_no_searchable_attribute_set() { ) .await; - let (task,_status_code) = index.update_settings_searchable_attributes(json!(["*"])).await; + let (task, _status_code) = index.update_settings_searchable_attributes(json!(["*"])).await; index.wait_task(task.uid()).await.succeeded(); index @@ -78,7 +78,7 @@ async fn search_no_searchable_attribute_set() { ) .await; - let (task,_status_code) = index.update_settings_searchable_attributes(json!(["*"])).await; + let (task, _status_code) = index.update_settings_searchable_attributes(json!(["*"])).await; index.wait_task(task.uid()).await.succeeded(); index @@ -109,7 +109,7 @@ async fn search_on_all_attributes() { async fn search_on_all_attributes_restricted_set() { let server = Server::new().await; let index = index_with_documents(&server, &SIMPLE_SEARCH_DOCUMENTS).await; - let (task,_status_code) = index.update_settings_searchable_attributes(json!(["title"])).await; + let (task, _status_code) = index.update_settings_searchable_attributes(json!(["title"])).await; index.wait_task(task.uid()).await.succeeded(); index @@ -192,7 +192,9 @@ async fn word_ranking_rule_order() { async fn word_ranking_rule_order_exact_words() { let server = Server::new().await; let index = index_with_documents(&server, &SIMPLE_SEARCH_DOCUMENTS).await; - let (task,_status_code) = index.update_settings_typo_tolerance(json!({"disableOnWords": ["Captain", "Marvel"]})).await; + let (task, _status_code) = index + .update_settings_typo_tolerance(json!({"disableOnWords": ["Captain", "Marvel"]})) + .await; index.wait_task(task.uid()).await.succeeded(); // simple search should return 2 documents (ids: 2 and 3). diff --git a/crates/meilisearch/tests/settings/distinct.rs b/crates/meilisearch/tests/settings/distinct.rs index 9d402bb52..2c5b7517f 100644 --- a/crates/meilisearch/tests/settings/distinct.rs +++ b/crates/meilisearch/tests/settings/distinct.rs @@ -13,7 +13,7 @@ async fn set_and_reset_distinct_attribute() { assert_eq!(response["distinctAttribute"], "test"); - let (task2,_status_code) = index.update_settings(json!({ "distinctAttribute": null })).await; + let (task2, _status_code) = index.update_settings(json!({ "distinctAttribute": null })).await; index.wait_task(task2.uid()).await.succeeded(); @@ -34,7 +34,7 @@ async fn set_and_reset_distinct_attribute_with_dedicated_route() { assert_eq!(response, "test"); - let (update_task2,_status_code) = index.update_distinct_attribute(json!(null)).await; + let (update_task2, _status_code) = index.update_distinct_attribute(json!(null)).await; index.wait_task(update_task2.uid()).await.succeeded(); diff --git a/crates/meilisearch/tests/settings/get_settings.rs b/crates/meilisearch/tests/settings/get_settings.rs index 3d9be456e..38d920652 100644 --- a/crates/meilisearch/tests/settings/get_settings.rs +++ b/crates/meilisearch/tests/settings/get_settings.rs @@ -436,7 +436,7 @@ async fn reset_all_settings() { assert_eq!(response["synonyms"], json!({"puppy": ["dog", "doggo", "potat"] })); assert_eq!(response["filterableAttributes"], json!(["age"])); - let (delete_task,_status_code) = index.delete_settings().await; + let (delete_task, _status_code) = index.delete_settings().await; index.wait_task(delete_task.uid()).await.succeeded(); let (response, code) = index.settings().await; @@ -462,7 +462,7 @@ async fn update_setting_unexisting_index() { assert_eq!(response["status"], "succeeded"); let (_response, code) = index.get().await; assert_eq!(code, 200); - let (task,_status_code) = index.delete_settings().await; + let (task, _status_code) = index.delete_settings().await; let response = index.wait_task(task.uid()).await; assert_eq!(response["status"], "succeeded"); } @@ -513,7 +513,7 @@ async fn set_and_reset_distinct_attribute_with_dedicated_route() { assert_eq!(response, "test"); - let (task,_status_code) = index.update_distinct_attribute(json!(null)).await; + let (task, _status_code) = index.update_distinct_attribute(json!(null)).await; index.wait_task(task.uid()).await.succeeded(); diff --git a/crates/meilisearch/tests/settings/proximity_settings.rs b/crates/meilisearch/tests/settings/proximity_settings.rs index d29351e8d..c5897bc51 100644 --- a/crates/meilisearch/tests/settings/proximity_settings.rs +++ b/crates/meilisearch/tests/settings/proximity_settings.rs @@ -29,7 +29,7 @@ async fn attribute_scale_search() { let server = Server::new().await; let index = server.index("test"); - let (task,_status_code) = index.add_documents(DOCUMENTS.clone(), None).await; + let (task, _status_code) = index.add_documents(DOCUMENTS.clone(), None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = index @@ -102,7 +102,7 @@ async fn attribute_scale_phrase_search() { let server = Server::new().await; let index = server.index("test"); - let (task,_status_code) = index.add_documents(DOCUMENTS.clone(), None).await; + let (task, _status_code) = index.add_documents(DOCUMENTS.clone(), None).await; index.wait_task(task.uid()).await.succeeded(); let (task, _code) = index @@ -170,7 +170,7 @@ async fn word_scale_set_and_reset() { let server = Server::new().await; let index = server.index("test"); - let (task,_status_code) = index.add_documents(DOCUMENTS.clone(), None).await; + let (task, _status_code) = index.add_documents(DOCUMENTS.clone(), None).await; index.wait_task(task.uid()).await.succeeded(); // Set and reset the setting ensuring the swap between the 2 settings is applied. @@ -285,7 +285,7 @@ async fn attribute_scale_default_ranking_rules() { let server = Server::new().await; let index = server.index("test"); - let (task,_status_code) = index.add_documents(DOCUMENTS.clone(), None).await; + let (task, _status_code) = index.add_documents(DOCUMENTS.clone(), None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = index diff --git a/crates/meilisearch/tests/settings/tokenizer_customization.rs b/crates/meilisearch/tests/settings/tokenizer_customization.rs index baf66be99..844eb3b98 100644 --- a/crates/meilisearch/tests/settings/tokenizer_customization.rs +++ b/crates/meilisearch/tests/settings/tokenizer_customization.rs @@ -38,7 +38,7 @@ async fn set_and_reset() { ] "###); - let (task,_status_code) = index + let (task, _status_code) = index .update_settings(json!({ "nonSeparatorTokens": null, "separatorTokens": null, @@ -74,7 +74,7 @@ async fn set_and_search() { let server = Server::new().await; let index = server.index("test"); - let (add_task,_status_code) = index.add_documents(documents, None).await; + let (add_task, _status_code) = index.add_documents(documents, None).await; index.wait_task(add_task.uid()).await.succeeded(); let (update_task, _code) = index @@ -228,7 +228,7 @@ async fn advanced_synergies() { let server = Server::new().await; let index = server.index("test"); - let (add_task,_status_code) = index.add_documents(documents, None).await; + let (add_task, _status_code) = index.add_documents(documents, None).await; index.wait_task(add_task.uid()).await.succeeded(); let (update_task, _code) = index diff --git a/crates/meilisearch/tests/snapshot/mod.rs b/crates/meilisearch/tests/snapshot/mod.rs index 16314854a..0f3417cdf 100644 --- a/crates/meilisearch/tests/snapshot/mod.rs +++ b/crates/meilisearch/tests/snapshot/mod.rs @@ -129,10 +129,10 @@ async fn perform_on_demand_snapshot() { index.load_test_set().await; - let (task,_status_code) = server.index("doggo").create(Some("bone")).await; + let (task, _status_code) = server.index("doggo").create(Some("bone")).await; index.wait_task(task.uid()).await.succeeded(); - let (task,_status_code) = server.index("doggo").create(Some("bone")).await; + let (task, _status_code) = server.index("doggo").create(Some("bone")).await; index.wait_task(task.uid()).await.failed(); let (task, code) = server.create_snapshot().await; diff --git a/crates/meilisearch/tests/tasks/mod.rs b/crates/meilisearch/tests/tasks/mod.rs index 52e6c2575..6383591ac 100644 --- a/crates/meilisearch/tests/tasks/mod.rs +++ b/crates/meilisearch/tests/tasks/mod.rs @@ -13,7 +13,7 @@ use crate::json; async fn error_get_unexisting_task_status() { let server = Server::new().await; let index = server.index("test"); - let (task,_status_code) = index.create(None).await; + let (task, _status_code) = index.create(None).await; index.wait_task(task.uid()).await.succeeded(); let (response, code) = index.get_task(1).await; @@ -32,8 +32,8 @@ async fn error_get_unexisting_task_status() { async fn get_task_status() { let server = Server::new().await; let index = server.index("test"); - let (create_task,_status_code) = index.create(None).await; - let (add_task,_status_code) = index + let (create_task, _status_code) = index.create(None).await; + let (add_task, _status_code) = index .add_documents( json!([{ "id": 1, @@ -52,7 +52,7 @@ async fn get_task_status() { async fn list_tasks() { let server = Server::new().await; let index = server.index("test"); - let (task,_status_code) = index.create(None).await; + let (task, _status_code) = index.create(None).await; index.wait_task(task.uid()).await.succeeded(); index .add_documents(serde_json::from_str(include_str!("../assets/test_set.json")).unwrap(), None) @@ -149,7 +149,7 @@ async fn list_tasks_with_star_filters() { async fn list_tasks_status_filtered() { let server = Server::new().await; let index = server.index("test"); - let (task,_status_code) = index.create(None).await; + let (task, _status_code) = index.create(None).await; index.wait_task(task.uid()).await.succeeded(); index .add_documents(serde_json::from_str(include_str!("../assets/test_set.json")).unwrap(), None) @@ -175,7 +175,7 @@ async fn list_tasks_status_filtered() { async fn list_tasks_type_filtered() { let server = Server::new().await; let index = server.index("test"); - let (task,_status_code) = index.create(None).await; + let (task, _status_code) = index.create(None).await; index.wait_task(task.uid()).await.succeeded(); index .add_documents(serde_json::from_str(include_str!("../assets/test_set.json")).unwrap(), None) @@ -195,7 +195,7 @@ async fn list_tasks_type_filtered() { async fn list_tasks_invalid_canceled_by_filter() { let server = Server::new().await; let index = server.index("test"); - let (task,_status_code) = index.create(None).await; + let (task, _status_code) = index.create(None).await; index.wait_task(task.uid()).await.succeeded(); index .add_documents(serde_json::from_str(include_str!("../assets/test_set.json")).unwrap(), None) @@ -210,7 +210,7 @@ async fn list_tasks_invalid_canceled_by_filter() { async fn list_tasks_status_and_type_filtered() { let server = Server::new().await; let index = server.index("test"); - let (task,_status_code) = index.create(None).await; + let (task, _status_code) = index.create(None).await; index.wait_task(task.uid()).await.succeeded(); index .add_documents(serde_json::from_str(include_str!("../assets/test_set.json")).unwrap(), None) @@ -278,7 +278,8 @@ async fn test_summarized_task_view() { async fn test_summarized_document_addition_or_update() { let server = Server::new().await; let index = server.index("test"); - let (task,_status_code) = index.add_documents(json!({ "id": 42, "content": "doggos & fluff" }), None).await; + let (task, _status_code) = + index.add_documents(json!({ "id": 42, "content": "doggos & fluff" }), None).await; index.wait_task(task.uid()).await.succeeded(); let (task, _) = index.get_task(0).await; assert_json_snapshot!(task, @@ -303,7 +304,8 @@ async fn test_summarized_document_addition_or_update() { } "###); - let (task,_status_code) = index.add_documents(json!({ "id": 42, "content": "doggos & fluff" }), Some("id")).await; + let (task, _status_code) = + index.add_documents(json!({ "id": 42, "content": "doggos & fluff" }), Some("id")).await; index.wait_task(task.uid()).await.succeeded(); let (task, _) = index.get_task(1).await; assert_json_snapshot!(task, @@ -333,7 +335,7 @@ async fn test_summarized_document_addition_or_update() { async fn test_summarized_delete_documents_by_batch() { let server = Server::new().await; let index = server.index("test"); - let (task,_status_code) = index.delete_batch(vec![1, 2, 3]).await; + let (task, _status_code) = index.delete_batch(vec![1, 2, 3]).await; index.wait_task(task.uid()).await.succeeded(); let (task, _) = index.get_task(0).await; assert_json_snapshot!(task, @@ -365,7 +367,7 @@ async fn test_summarized_delete_documents_by_batch() { "###); index.create(None).await; - let (del_task,_status_code) = index.delete_batch(vec![42]).await; + let (del_task, _status_code) = index.delete_batch(vec![42]).await; index.wait_task(del_task.uid()).await.succeeded(); let (task, _) = index.get_task(del_task.uid()).await; assert_json_snapshot!(task, @@ -397,7 +399,8 @@ async fn test_summarized_delete_documents_by_filter() { let server = Server::new().await; let index = server.index("test"); - let (task,_status_code) = index.delete_document_by_filter(json!({ "filter": "doggo = bernese" })).await; + let (task, _status_code) = + index.delete_document_by_filter(json!({ "filter": "doggo = bernese" })).await; index.wait_task(task.uid()).await.succeeded(); let (task, _) = index.get_task(task.uid()).await; assert_json_snapshot!(task, @@ -429,7 +432,8 @@ async fn test_summarized_delete_documents_by_filter() { "###); index.create(None).await; - let (task,_status_code) = index.delete_document_by_filter(json!({ "filter": "doggo = bernese" })).await; + let (task, _status_code) = + index.delete_document_by_filter(json!({ "filter": "doggo = bernese" })).await; index.wait_task(task.uid()).await.succeeded(); let (task, _) = index.get_task(task.uid()).await; assert_json_snapshot!(task, @@ -461,7 +465,8 @@ async fn test_summarized_delete_documents_by_filter() { "###); index.update_settings(json!({ "filterableAttributes": ["doggo"] })).await; - let (task,_status_code) = index.delete_document_by_filter(json!({ "filter": "doggo = bernese" })).await; + let (task, _status_code) = + index.delete_document_by_filter(json!({ "filter": "doggo = bernese" })).await; index.wait_task(task.uid()).await.succeeded(); let (task, _) = index.get_task(task.uid()).await; assert_json_snapshot!(task, @@ -492,7 +497,7 @@ async fn test_summarized_delete_documents_by_filter() { async fn test_summarized_delete_document_by_id() { let server = Server::new().await; let index = server.index("test"); - let (task,_status_code) = index.delete_document(1).await; + let (task, _status_code) = index.delete_document(1).await; index.wait_task(task.uid()).await.succeeded(); let (task, _) = index.get_task(task.uid()).await; assert_json_snapshot!(task, @@ -524,7 +529,7 @@ async fn test_summarized_delete_document_by_id() { "###); index.create(None).await; - let (task,_status_code) = index.delete_document(42).await; + let (task, _status_code) = index.delete_document(42).await; index.wait_task(task.uid()).await.succeeded(); let (task, _) = index.get_task(task.uid()).await; assert_json_snapshot!(task, @@ -606,7 +611,7 @@ async fn test_summarized_settings_update() { async fn test_summarized_index_creation() { let server = Server::new().await; let index = server.index("test"); - let (task,_status_code) = index.create(None).await; + let (task, _status_code) = index.create(None).await; index.wait_task(task.uid()).await.succeeded(); let (task, _) = index.get_task(task.uid()).await; assert_json_snapshot!(task, @@ -630,7 +635,7 @@ async fn test_summarized_index_creation() { } "###); - let (task,_status_code) = index.create(Some("doggos")).await; + let (task, _status_code) = index.create(Some("doggos")).await; index.wait_task(task.uid()).await.succeeded(); let (task, _) = index.get_task(task.uid()).await; assert_json_snapshot!(task, @@ -774,7 +779,7 @@ async fn test_summarized_index_update() { let server = Server::new().await; let index = server.index("test"); // If the index doesn't exist yet, we should get errors with or without the primary key. - let (task,_status_code) = index.update(None).await; + let (task, _status_code) = index.update(None).await; index.wait_task(task.uid()).await.succeeded(); let (task, _) = index.get_task(task.uid()).await; assert_json_snapshot!(task, @@ -803,7 +808,7 @@ async fn test_summarized_index_update() { } "###); - let (task,_status_code) = index.update(Some("bones")).await; + let (task, _status_code) = index.update(Some("bones")).await; index.wait_task(task.uid()).await.succeeded(); let (task, _) = index.get_task(task.uid()).await; assert_json_snapshot!(task, @@ -835,7 +840,7 @@ async fn test_summarized_index_update() { // And run the same two tests once the index do exists. index.create(None).await; - let (task,_status_code) = index.update(None).await; + let (task, _status_code) = index.update(None).await; index.wait_task(task.uid()).await.succeeded(); let (task, _) = index.get_task(task.uid()).await; assert_json_snapshot!(task, @@ -859,7 +864,7 @@ async fn test_summarized_index_update() { } "###); - let (task,_status_code) = index.update(Some("bones")).await; + let (task, _status_code) = index.update(Some("bones")).await; index.wait_task(task.uid()).await.succeeded(); let (task, _) = index.get_task(task.uid()).await; assert_json_snapshot!(task, @@ -887,7 +892,7 @@ async fn test_summarized_index_update() { #[actix_web::test] async fn test_summarized_index_swap() { let server = Server::new().await; - let (task,_status_code) = server + let (task, _status_code) = server .index_swap(json!([ { "indexes": ["doggos", "cattos"] } ])) @@ -928,7 +933,7 @@ async fn test_summarized_index_swap() { "###); server.index("doggos").create(None).await; - let (task,_status_code) = server.index("cattos").create(None).await; + let (task, _status_code) = server.index("cattos").create(None).await; server .index_swap(json!([ { "indexes": ["doggos", "cattos"] } @@ -970,9 +975,9 @@ async fn test_summarized_task_cancelation() { let server = Server::new().await; let index = server.index("doggos"); // to avoid being flaky we're only going to cancel an already finished task :( - let (task,_status_code) = index.create(None).await; + let (task, _status_code) = index.create(None).await; index.wait_task(task.uid()).await.succeeded(); - let (task,_status_code) = server.cancel_tasks("uids=0").await; + let (task, _status_code) = server.cancel_tasks("uids=0").await; index.wait_task(task.uid()).await.succeeded(); let (task, _) = index.get_task(task.uid()).await; assert_json_snapshot!(task, @@ -1004,9 +1009,9 @@ async fn test_summarized_task_deletion() { let server = Server::new().await; let index = server.index("doggos"); // to avoid being flaky we're only going to delete an already finished task :( - let (task,_status_code) = index.create(None).await; + let (task, _status_code) = index.create(None).await; index.wait_task(task.uid()).await.succeeded(); - let (task,_status_code) = server.delete_tasks("uids=0").await; + let (task, _status_code) = server.delete_tasks("uids=0").await; index.wait_task(task.uid()).await.succeeded(); let (task, _) = index.get_task(task.uid()).await; assert_json_snapshot!(task, @@ -1036,7 +1041,7 @@ async fn test_summarized_task_deletion() { #[actix_web::test] async fn test_summarized_dump_creation() { let server = Server::new().await; - let (task,_status_code) = server.create_dump().await; + let (task, _status_code) = server.create_dump().await; server.wait_task(task.uid()).await; let (task, _) = server.get_task(task.uid()).await; assert_json_snapshot!(task,