Format fixes after running: cargo +nightly fmt

This commit is contained in:
Mahmoud Rawas 2025-01-07 11:16:37 +11:00
parent d7cb319217
commit 98e3ecb86b
21 changed files with 208 additions and 189 deletions

View File

@ -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());

View File

@ -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,
@ -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,

View File

@ -30,7 +30,8 @@ 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;
assert_eq!(status_code, 202);

View File

@ -221,7 +221,8 @@ async fn negative_special_cases_search() {
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
@ -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
@ -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
@ -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
@ -1587,7 +1591,8 @@ 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""###);

View File

@ -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).

View File

@ -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,
@ -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,