From e579554c84a82ea1220e769f6286d892bca30f40 Mon Sep 17 00:00:00 2001 From: Tamo Date: Mon, 6 Jan 2025 11:57:25 +0100 Subject: [PATCH] fmt --- crates/meilisearch/src/routes/api_key.rs | 7 ---- crates/meilisearch/src/routes/batches.rs | 1 - crates/meilisearch/src/routes/dump.rs | 1 - crates/meilisearch/src/routes/features.rs | 1 - crates/meilisearch/src/routes/logs.rs | 3 -- crates/meilisearch/src/routes/metrics.rs | 11 +++--- crates/meilisearch/src/routes/mod.rs | 36 +++++++++---------- crates/meilisearch/src/routes/multi_search.rs | 5 ++- crates/meilisearch/src/routes/snapshot.rs | 1 - crates/meilisearch/src/routes/tasks.rs | 2 -- 10 files changed, 22 insertions(+), 46 deletions(-) diff --git a/crates/meilisearch/src/routes/api_key.rs b/crates/meilisearch/src/routes/api_key.rs index e45326069..9f832b0f2 100644 --- a/crates/meilisearch/src/routes/api_key.rs +++ b/crates/meilisearch/src/routes/api_key.rs @@ -31,7 +31,6 @@ use crate::routes::Pagination; You must have the master key or the default admin key to access the keys route. More information about the keys and their rights. Accessing any route under `/keys` without having set a master key will result in an error.", external_docs(url = "https://www.meilisearch.com/docs/reference/api/keys"), - )), )] pub struct ApiKeyApi; @@ -50,7 +49,6 @@ pub fn configure(cfg: &mut web::ServiceConfig) { ); } - /// Create an API Key /// /// Create an API Key. @@ -130,7 +128,6 @@ impl ListApiKeys { } } - /// Get API Keys /// /// List all API Keys @@ -201,7 +198,6 @@ pub async fn list_api_keys( Ok(HttpResponse::Ok().json(page_view)) } - /// Get an API Key /// /// Get an API key from its `uid` or its `key` field. @@ -266,7 +262,6 @@ pub async fn get_api_key( Ok(HttpResponse::Ok().json(res)) } - /// Update a Key /// /// Update the name and description of an API key. @@ -334,8 +329,6 @@ pub async fn patch_api_key( Ok(HttpResponse::Ok().json(res)) } - - /// Delete a key /// /// Delete the specified API key. diff --git a/crates/meilisearch/src/routes/batches.rs b/crates/meilisearch/src/routes/batches.rs index a5fc77a3d..7a801dae6 100644 --- a/crates/meilisearch/src/routes/batches.rs +++ b/crates/meilisearch/src/routes/batches.rs @@ -22,7 +22,6 @@ use crate::extractors::sequential_extractor::SeqHandler; name = "Batches", description = "The /batches route gives information about the progress of batches of asynchronous operations.", external_docs(url = "https://www.meilisearch.com/docs/reference/api/batches"), - )), )] pub struct BatchesApi; diff --git a/crates/meilisearch/src/routes/dump.rs b/crates/meilisearch/src/routes/dump.rs index 37f06d4c6..8bcb167ee 100644 --- a/crates/meilisearch/src/routes/dump.rs +++ b/crates/meilisearch/src/routes/dump.rs @@ -28,7 +28,6 @@ all indexes contained in the indicated `.dump` file are imported along with thei Any existing index with the same uid as an index in the dump file will be overwritten. Dump imports are [performed at launch](https://www.meilisearch.com/docs/learn/advanced/dumps#importing-a-dump) using an option.", external_docs(url = "https://www.meilisearch.com/docs/reference/api/dump"), - )), )] pub struct DumpApi; diff --git a/crates/meilisearch/src/routes/features.rs b/crates/meilisearch/src/routes/features.rs index 506e73b2e..b7e85882f 100644 --- a/crates/meilisearch/src/routes/features.rs +++ b/crates/meilisearch/src/routes/features.rs @@ -24,7 +24,6 @@ use crate::extractors::sequential_extractor::SeqHandler; This route is **synchronous**. This means that no task object will be returned, and any activated or deactivated features will be made available or unavailable immediately.", external_docs(url = "https://www.meilisearch.com/docs/reference/api/experimental_features"), - )), )] pub struct ExperimentalFeaturesApi; diff --git a/crates/meilisearch/src/routes/logs.rs b/crates/meilisearch/src/routes/logs.rs index dc6b6d14c..889ce824e 100644 --- a/crates/meilisearch/src/routes/logs.rs +++ b/crates/meilisearch/src/routes/logs.rs @@ -26,7 +26,6 @@ use crate::extractors::authentication::GuardedData; use crate::extractors::sequential_extractor::SeqHandler; use crate::{LogRouteHandle, LogStderrHandle}; - #[derive(OpenApi)] #[openapi( paths(get_logs, cancel_logs, update_stderr_target), @@ -35,7 +34,6 @@ use crate::{LogRouteHandle, LogStderrHandle}; description = "Everything about retrieving or customizing logs. Currently [experimental](https://www.meilisearch.com/docs/learn/experimental/overview).", external_docs(url = "https://www.meilisearch.com/docs/learn/experimental/log_customization"), - )), )] pub struct LogsApi; @@ -350,7 +348,6 @@ pub async fn get_logs( } } - /// Stop retrieving logs /// /// Call this route to make the engine stops sending logs through the `POST /logs/stream` route. diff --git a/crates/meilisearch/src/routes/metrics.rs b/crates/meilisearch/src/routes/metrics.rs index daae66c2e..192164288 100644 --- a/crates/meilisearch/src/routes/metrics.rs +++ b/crates/meilisearch/src/routes/metrics.rs @@ -5,17 +5,14 @@ use crate::search_queue::SearchQueue; use actix_web::http::header; use actix_web::web::{self, Data}; use actix_web::HttpResponse; -use index_scheduler::IndexScheduler; +use index_scheduler::{IndexScheduler, Query}; use meilisearch_auth::AuthController; use meilisearch_types::error::ResponseError; use meilisearch_types::keys::actions; -use prometheus::{Encoder, TextEncoder}; -use utoipa::OpenApi; - -use time::OffsetDateTime; - -use index_scheduler::Query; use meilisearch_types::tasks::Status; +use prometheus::{Encoder, TextEncoder}; +use time::OffsetDateTime; +use utoipa::OpenApi; #[derive(OpenApi)] #[openapi(paths(get_metrics))] diff --git a/crates/meilisearch/src/routes/mod.rs b/crates/meilisearch/src/routes/mod.rs index b3044b3dd..b0d6ac17f 100644 --- a/crates/meilisearch/src/routes/mod.rs +++ b/crates/meilisearch/src/routes/mod.rs @@ -1,22 +1,5 @@ use std::collections::BTreeMap; -use crate::extractors::authentication::policies::*; -use crate::extractors::authentication::GuardedData; -use crate::milli::progress::ProgressStepView; -use crate::milli::progress::ProgressView; -use crate::routes::batches::AllBatches; -use crate::routes::features::RuntimeTogglableFeatures; -use crate::routes::indexes::documents::DocumentDeletionByFilter; -use crate::routes::indexes::documents::DocumentEditionByFunction; -use crate::routes::indexes::IndexView; -use crate::routes::multi_search::SearchResults; -use crate::routes::swap_indexes::SwapIndexesPayload; -use crate::search::{ - FederatedSearch, FederatedSearchResult, Federation, FederationOptions, MergeFacets, - SearchQueryWithIndex, SearchResultWithIndex, SimilarQuery, SimilarResult, -}; -use crate::search_queue::SearchQueue; -use crate::Opt; use actix_web::web::Data; use actix_web::{web, HttpRequest, HttpResponse}; use index_scheduler::IndexScheduler; @@ -41,11 +24,24 @@ use utoipa_scalar::{Scalar, Servable as ScalarServable}; use self::api_key::KeyView; use self::indexes::documents::BrowseQuery; use self::indexes::{IndexCreateRequest, IndexStats, UpdateIndexRequest}; -use self::logs::GetLogs; -use self::logs::LogMode; -use self::logs::UpdateStderrLogs; +use self::logs::{GetLogs, LogMode, UpdateStderrLogs}; use self::open_api_utils::OpenApiAuth; use self::tasks::AllTasks; +use crate::extractors::authentication::policies::*; +use crate::extractors::authentication::GuardedData; +use crate::milli::progress::{ProgressStepView, ProgressView}; +use crate::routes::batches::AllBatches; +use crate::routes::features::RuntimeTogglableFeatures; +use crate::routes::indexes::documents::{DocumentDeletionByFilter, DocumentEditionByFunction}; +use crate::routes::indexes::IndexView; +use crate::routes::multi_search::SearchResults; +use crate::routes::swap_indexes::SwapIndexesPayload; +use crate::search::{ + FederatedSearch, FederatedSearchResult, Federation, FederationOptions, MergeFacets, + SearchQueryWithIndex, SearchResultWithIndex, SimilarQuery, SimilarResult, +}; +use crate::search_queue::SearchQueue; +use crate::Opt; const PAGINATION_DEFAULT_LIMIT: usize = 20; const PAGINATION_DEFAULT_LIMIT_FN: fn() -> usize = || 20; diff --git a/crates/meilisearch/src/routes/multi_search.rs b/crates/meilisearch/src/routes/multi_search.rs index 711bdd03c..2d15d29bf 100644 --- a/crates/meilisearch/src/routes/multi_search.rs +++ b/crates/meilisearch/src/routes/multi_search.rs @@ -18,8 +18,8 @@ use crate::extractors::authentication::{AuthenticationError, GuardedData}; use crate::extractors::sequential_extractor::SeqHandler; use crate::routes::indexes::search::search_kind; use crate::search::{ - add_search_rules, perform_federated_search, perform_search, FederatedSearch, FederatedSearchResult, RetrieveVectors, - SearchQueryWithIndex, SearchResultWithIndex, + add_search_rules, perform_federated_search, perform_search, FederatedSearch, + FederatedSearchResult, RetrieveVectors, SearchQueryWithIndex, SearchResultWithIndex, }; use crate::search_queue::SearchQueue; @@ -30,7 +30,6 @@ use crate::search_queue::SearchQueue; name = "Multi-search", description = "The `/multi-search` route allows you to perform multiple search queries on one or more indexes by bundling them into a single HTTP request. Multi-search is also known as federated search.", external_docs(url = "https://www.meilisearch.com/docs/reference/api/multi_search"), - )), )] pub struct MultiSearchApi; diff --git a/crates/meilisearch/src/routes/snapshot.rs b/crates/meilisearch/src/routes/snapshot.rs index b619d7411..b7bb116ed 100644 --- a/crates/meilisearch/src/routes/snapshot.rs +++ b/crates/meilisearch/src/routes/snapshot.rs @@ -24,7 +24,6 @@ During a snapshot export, all indexes of the current instance are exported—tog During a snapshot import, all indexes contained in the indicated .snapshot file are imported along with their associated documents and settings. Snapshot imports are performed at launch using an option.", external_docs(url = "https://www.meilisearch.com/docs/reference/api/snapshots"), - )), )] pub struct SnapshotApi; diff --git a/crates/meilisearch/src/routes/tasks.rs b/crates/meilisearch/src/routes/tasks.rs index 2f3871c1a..fce2bc8bf 100644 --- a/crates/meilisearch/src/routes/tasks.rs +++ b/crates/meilisearch/src/routes/tasks.rs @@ -33,7 +33,6 @@ use crate::{aggregate_methods, Opt}; name = "Tasks", description = "The tasks route gives information about the progress of the [asynchronous operations](https://docs.meilisearch.com/learn/advanced/asynchronous_operations.html).", external_docs(url = "https://www.meilisearch.com/docs/reference/api/tasks"), - )), )] pub struct TaskApi; @@ -496,7 +495,6 @@ pub struct AllTasks { next: Option, } - /// Get all tasks /// /// Get all [tasks](https://docs.meilisearch.com/learn/advanced/asynchronous_operations.html)