2576: Make clippy happy r=curquiza a=Kerollmops

This PR fixes clippy.

Co-authored-by: Kerollmops <clement@meilisearch.com>
This commit is contained in:
bors[bot] 2022-07-04 11:53:27 +00:00 committed by GitHub
commit 83e5f45a91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 11 deletions

View File

@ -31,7 +31,7 @@ pub fn setup_meilisearch(opt: &Opt) -> anyhow::Result<MeiliSearch> {
let mut meilisearch = MeiliSearch::builder(); let mut meilisearch = MeiliSearch::builder();
// enable autobatching? // enable autobatching?
let _ = AUTOBATCHING_ENABLED.store( AUTOBATCHING_ENABLED.store(
opt.scheduler_options.enable_auto_batching, opt.scheduler_options.enable_auto_batching,
std::sync::atomic::Ordering::Relaxed, std::sync::atomic::Ordering::Relaxed,
); );

View File

@ -108,10 +108,9 @@ fn fix_sort_query_parameters(sort_query: &str) -> Vec<String> {
sort_parameters.push(current_sort.to_string()); sort_parameters.push(current_sort.to_string());
merge = true; merge = true;
} else if merge && !sort_parameters.is_empty() { } else if merge && !sort_parameters.is_empty() {
sort_parameters let s = sort_parameters.last_mut().unwrap();
.last_mut() s.push(',');
.unwrap() s.push_str(current_sort);
.push_str(&format!(",{}", current_sort));
if current_sort.ends_with("):desc") || current_sort.ends_with("):asc") { if current_sort.ends_with("):desc") || current_sort.ends_with("):asc") {
merge = false; merge = false;
} }

View File

@ -1,4 +1,5 @@
use std::{ use std::{
fmt::Write,
panic::{catch_unwind, resume_unwind, UnwindSafe}, panic::{catch_unwind, resume_unwind, UnwindSafe},
time::Duration, time::Duration,
}; };
@ -118,10 +119,10 @@ impl Index<'_> {
pub async fn filtered_tasks(&self, type_: &[&str], status: &[&str]) -> (Value, StatusCode) { pub async fn filtered_tasks(&self, type_: &[&str], status: &[&str]) -> (Value, StatusCode) {
let mut url = format!("/tasks?indexUid={}", self.uid); let mut url = format!("/tasks?indexUid={}", self.uid);
if !type_.is_empty() { if !type_.is_empty() {
url += &format!("&type={}", type_.join(",")); let _ = write!(url, "&type={}", type_.join(","));
} }
if !status.is_empty() { if !status.is_empty() {
url += &format!("&status={}", status.join(",")); let _ = write!(url, "&status={}", status.join(","));
} }
self.service.get(url).await self.service.get(url).await
} }
@ -133,7 +134,7 @@ impl Index<'_> {
) -> (Value, StatusCode) { ) -> (Value, StatusCode) {
let mut url = format!("/indexes/{}/documents/{}", encode(self.uid.as_ref()), id); let mut url = format!("/indexes/{}/documents/{}", encode(self.uid.as_ref()), id);
if let Some(fields) = options.and_then(|o| o.fields) { 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 self.service.get(url).await
} }
@ -141,15 +142,15 @@ impl Index<'_> {
pub async fn get_all_documents(&self, options: GetAllDocumentsOptions) -> (Value, StatusCode) { pub async fn get_all_documents(&self, options: GetAllDocumentsOptions) -> (Value, StatusCode) {
let mut url = format!("/indexes/{}/documents?", encode(self.uid.as_ref())); let mut url = format!("/indexes/{}/documents?", encode(self.uid.as_ref()));
if let Some(limit) = options.limit { if let Some(limit) = options.limit {
url.push_str(&format!("limit={}&", limit)); let _ = write!(url, "limit={}&", limit);
} }
if let Some(offset) = options.offset { 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 { 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 self.service.get(url).await