From aff8cd17746193a50814aa4d34793aef6436f747 Mon Sep 17 00:00:00 2001 From: Kerollmops Date: Mon, 4 Jul 2022 12:00:03 +0200 Subject: [PATCH] Make clippy happy --- meilisearch-http/src/lib.rs | 2 +- meilisearch-http/src/routes/indexes/search.rs | 7 +++---- meilisearch-http/tests/common/index.rs | 13 +++++++------ 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/meilisearch-http/src/lib.rs b/meilisearch-http/src/lib.rs index bfdb829d4..6485784fc 100644 --- a/meilisearch-http/src/lib.rs +++ b/meilisearch-http/src/lib.rs @@ -31,7 +31,7 @@ pub fn setup_meilisearch(opt: &Opt) -> anyhow::Result { let mut meilisearch = MeiliSearch::builder(); // enable autobatching? - let _ = AUTOBATCHING_ENABLED.store( + AUTOBATCHING_ENABLED.store( opt.scheduler_options.enable_auto_batching, std::sync::atomic::Ordering::Relaxed, ); diff --git a/meilisearch-http/src/routes/indexes/search.rs b/meilisearch-http/src/routes/indexes/search.rs index 3f8fecd5c..a5d1f1a5c 100644 --- a/meilisearch-http/src/routes/indexes/search.rs +++ b/meilisearch-http/src/routes/indexes/search.rs @@ -108,10 +108,9 @@ fn fix_sort_query_parameters(sort_query: &str) -> Vec { sort_parameters.push(current_sort.to_string()); merge = true; } else if merge && !sort_parameters.is_empty() { - sort_parameters - .last_mut() - .unwrap() - .push_str(&format!(",{}", current_sort)); + let s = sort_parameters.last_mut().unwrap(); + s.push(','); + s.push_str(current_sort); if current_sort.ends_with("):desc") || current_sort.ends_with("):asc") { merge = false; } diff --git a/meilisearch-http/tests/common/index.rs b/meilisearch-http/tests/common/index.rs index 010535e21..54618442c 100644 --- a/meilisearch-http/tests/common/index.rs +++ b/meilisearch-http/tests/common/index.rs @@ -1,4 +1,5 @@ use std::{ + fmt::Write, panic::{catch_unwind, resume_unwind, UnwindSafe}, time::Duration, }; @@ -118,10 +119,10 @@ impl Index<'_> { pub async fn filtered_tasks(&self, type_: &[&str], status: &[&str]) -> (Value, StatusCode) { let mut url = format!("/tasks?indexUid={}", self.uid); if !type_.is_empty() { - url += &format!("&type={}", type_.join(",")); + let _ = write!(url, "&type={}", type_.join(",")); } if !status.is_empty() { - url += &format!("&status={}", status.join(",")); + let _ = write!(url, "&status={}", status.join(",")); } self.service.get(url).await } @@ -133,7 +134,7 @@ impl Index<'_> { ) -> (Value, StatusCode) { let mut url = format!("/indexes/{}/documents/{}", encode(self.uid.as_ref()), id); if let Some(fields) = options.and_then(|o| o.fields) { - url.push_str(&format!("?fields={}", fields.join(","))); + let _ = write!(url, "?fields={}", fields.join(",")); } self.service.get(url).await } @@ -141,15 +142,15 @@ impl Index<'_> { pub async fn get_all_documents(&self, options: GetAllDocumentsOptions) -> (Value, StatusCode) { let mut url = format!("/indexes/{}/documents?", encode(self.uid.as_ref())); if let Some(limit) = options.limit { - url.push_str(&format!("limit={}&", limit)); + let _ = write!(url, "limit={}&", limit); } if let Some(offset) = options.offset { - url.push_str(&format!("offset={}&", offset)); + let _ = write!(url, "offset={}&", offset); } if let Some(attributes_to_retrieve) = options.attributes_to_retrieve { - url.push_str(&format!("fields={}&", attributes_to_retrieve.join(","))); + let _ = write!(url, "fields={}&", attributes_to_retrieve.join(",")); } self.service.get(url).await