diff --git a/meilisearch-http/src/data.rs b/meilisearch-http/src/data.rs index dd915e882..7e5c92348 100644 --- a/meilisearch-http/src/data.rs +++ b/meilisearch-http/src/data.rs @@ -108,7 +108,7 @@ impl Data { let api_key = opt.api_key.clone(); let server_pid = sysinfo::get_current_pid().unwrap(); - let db = Arc::new(Database::open_or_create(opt.db_path.clone()).unwrap()); + let db = Arc::new(Database::open_or_create(opt.db_path).unwrap()); let inner_data = DataInner { db: db.clone(), diff --git a/meilisearch-http/src/lib.rs b/meilisearch-http/src/lib.rs index 199b780c4..db7fe97c3 100644 --- a/meilisearch-http/src/lib.rs +++ b/meilisearch-http/src/lib.rs @@ -1,3 +1,5 @@ +#![allow(clippy::or_fun_call)] + pub mod data; pub mod error; pub mod helpers; diff --git a/meilisearch-http/src/routes/document.rs b/meilisearch-http/src/routes/document.rs index d3577d6db..ec328ad13 100644 --- a/meilisearch-http/src/routes/document.rs +++ b/meilisearch-http/src/routes/document.rs @@ -44,7 +44,7 @@ pub async fn delete_document(ctx: Request) -> SResult { let index = ctx.index()?; let identifier = ctx.identifier()?; - let document_id = meilisearch_core::serde::compute_document_id(identifier.clone()); + let document_id = meilisearch_core::serde::compute_document_id(identifier); let db = &ctx.state().db; let mut update_writer = db.update_write_txn()?; let mut documents_deletion = index.documents_deletion(); @@ -69,7 +69,7 @@ pub async fn get_all_documents(ctx: Request) -> SResult { ctx.is_allowed(DocumentsRead)?; let index = ctx.index()?; - let query: BrowseQuery = ctx.query().unwrap_or(BrowseQuery::default()); + let query: BrowseQuery = ctx.query().unwrap_or_default(); let offset = query.offset.unwrap_or(0); let limit = query.limit.unwrap_or(20); @@ -115,7 +115,7 @@ fn find_identifier(document: &IndexMap) -> Option { return Some(key.to_string()); } } - return None; + None } #[derive(Default, Deserialize)] diff --git a/meilisearch-http/src/routes/index.rs b/meilisearch-http/src/routes/index.rs index baadc6346..95897b026 100644 --- a/meilisearch-http/src/routes/index.rs +++ b/meilisearch-http/src/routes/index.rs @@ -159,7 +159,7 @@ pub async fn create_index(mut ctx: Request) -> SResult { writer.commit()?; let response_body = IndexCreateResponse { - name: name, + name, uid, created_at, updated_at, diff --git a/meilisearch-http/src/routes/search.rs b/meilisearch-http/src/routes/search.rs index 2ed423334..ba25b8aba 100644 --- a/meilisearch-http/src/routes/search.rs +++ b/meilisearch-http/src/routes/search.rs @@ -64,7 +64,7 @@ pub async fn search_with_url_query(ctx: Request) -> SResult { let attributes_to_crop = schema .displayed_name() .iter() - .map(|attr| (attr.to_string(), crop_length)) + .map(|attr| ((*attr).to_string(), crop_length)) .collect(); search_builder.attributes_to_crop(attributes_to_crop); } else { @@ -81,7 +81,7 @@ pub async fn search_with_url_query(ctx: Request) -> SResult { schema .displayed_name() .iter() - .map(|s| s.to_string()) + .map(|s| (*s).to_string()) .collect() } else { attributes_to_highlight diff --git a/meilisearch-http/src/routes/setting.rs b/meilisearch-http/src/routes/setting.rs index b655578b3..57fcfed3d 100644 --- a/meilisearch-http/src/routes/setting.rs +++ b/meilisearch-http/src/routes/setting.rs @@ -1,5 +1,5 @@ use meilisearch_core::settings::{Settings, SettingsUpdate, UpdateState}; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; use std::collections::{BTreeMap, BTreeSet, HashSet}; use tide::{Request, Response}; @@ -57,10 +57,10 @@ pub async fn get_all(ctx: Request) -> SResult { let identifier = schema.clone().map(|s| s.identifier().to_owned()); let searchable_attributes = schema .clone() - .map(|s| s.indexed_name().iter().map(|s| s.to_string()).collect()); + .map(|s| s.indexed_name().iter().map(|s| (*s).to_string()).collect()); let displayed_attributes = schema .clone() - .map(|s| s.displayed_name().iter().map(|s| s.to_string()).collect()); + .map(|s| s.displayed_name().iter().map(|s| (*s).to_string()).collect()); let index_new_fields = schema.map(|s| s.index_new_fields()); let settings = Settings { @@ -268,7 +268,7 @@ pub async fn get_searchable(ctx: Request) -> SResult { let schema = index.main.schema(&reader)?; let searchable_attributes: Option> = - schema.map(|s| s.indexed_name().iter().map(|i| i.to_string()).collect()); + schema.map(|s| s.indexed_name().iter().map(|i| (*i).to_string()).collect()); Ok(tide::Response::new(200) .body_json(&searchable_attributes) @@ -322,7 +322,7 @@ pub async fn displayed(ctx: Request) -> SResult { let schema = index.main.schema(&reader)?; let displayed_attributes: Option> = - schema.map(|s| s.displayed_name().iter().map(|i| i.to_string()).collect()); + schema.map(|s| s.displayed_name().iter().map(|i| (*i).to_string()).collect()); Ok(tide::Response::new(200) .body_json(&displayed_attributes)