From 89b38993cbc6779b38e9b954469b3013633a9a2a Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Fri, 24 Jan 2025 22:47:27 +0100 Subject: [PATCH 1/3] Make doc-comments consistently be doc-commoents --- src/errors.rs | 6 +++--- src/search.rs | 8 ++++---- src/tasks.rs | 28 ++++++++++++++-------------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/errors.rs b/src/errors.rs index 480abf57..233323ed 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -49,16 +49,16 @@ pub enum Error { #[error("HTTP request failed: {}", .0)] HttpError(#[from] reqwest::Error), - // The library formatting the query parameters encountered an error. + /// The library formatting the query parameters encountered an error. #[error("Internal Error: could not parse the query parameters: {}", .0)] Yaup(#[from] yaup::Error), - // The library validating the format of an uuid. + /// The library validating the format of an uuid. #[cfg(not(target_arch = "wasm32"))] #[error("The uid of the token has bit an uuid4 format: {}", .0)] Uuid(#[from] uuid::Error), - // Error thrown in case the version of the Uuid is not v4. + /// Error thrown in case the version of the Uuid is not v4. #[error("The uid provided to the token is not of version uuidv4")] InvalidUuid4Version, diff --git a/src/search.rs b/src/search.rs index 824db05c..aa5c840c 100644 --- a/src/search.rs +++ b/src/search.rs @@ -76,13 +76,13 @@ pub struct SearchResults { pub limit: Option, /// Estimated total number of matches. pub estimated_total_hits: Option, - // Current page number + /// Current page number pub page: Option, - // Maximum number of hits in a page. + /// Maximum number of hits in a page. pub hits_per_page: Option, - // Exhaustive number of matches. + /// Exhaustive number of matches. pub total_hits: Option, - // Exhaustive number of pages. + /// Exhaustive number of pages. pub total_pages: Option, /// Distribution of the given facets. pub facet_distribution: Option>>, diff --git a/src/tasks.rs b/src/tasks.rs index 4ed43cd2..a0658fd5 100644 --- a/src/tasks.rs +++ b/src/tasks.rs @@ -474,10 +474,10 @@ impl AsRef for Task { #[derive(Debug, Serialize, Clone)] pub struct TasksPaginationFilters { - // Maximum number of tasks to return. + /// Maximum number of tasks to return. #[serde(skip_serializing_if = "Option::is_none")] limit: Option, - // The first task uid that should be returned. + /// The first task uid that should be returned. #[serde(skip_serializing_if = "Option::is_none")] from: Option, } @@ -497,52 +497,52 @@ pub type TasksDeleteQuery<'a, Http> = TasksQuery<'a, TasksDeleteFilters, Http>; pub struct TasksQuery<'a, T, Http: HttpClient> { #[serde(skip_serializing)] client: &'a Client, - // Index uids array to only retrieve the tasks of the indexes. + /// Index uids array to only retrieve the tasks of the indexes. #[serde(skip_serializing_if = "Option::is_none")] index_uids: Option>, - // Statuses array to only retrieve the tasks with these statuses. + /// Statuses array to only retrieve the tasks with these statuses. #[serde(skip_serializing_if = "Option::is_none")] statuses: Option>, - // Types array to only retrieve the tasks with these [TaskType]. + /// Types array to only retrieve the tasks with these [`TaskType`]s. #[serde(skip_serializing_if = "Option::is_none", rename = "types")] task_types: Option>, - // Uids of the tasks to retrieve. + /// Uids of the tasks to retrieve. #[serde(skip_serializing_if = "Option::is_none")] uids: Option>, - // Uids of the tasks that canceled other tasks. + /// Uids of the tasks that canceled other tasks. #[serde(skip_serializing_if = "Option::is_none")] canceled_by: Option>, - // Date to retrieve all tasks that were enqueued before it. + /// Date to retrieve all tasks that were enqueued before it. #[serde( skip_serializing_if = "Option::is_none", serialize_with = "time::serde::rfc3339::option::serialize" )] before_enqueued_at: Option, - // Date to retrieve all tasks that were enqueued after it. + /// Date to retrieve all tasks that were enqueued after it. #[serde( skip_serializing_if = "Option::is_none", serialize_with = "time::serde::rfc3339::option::serialize" )] after_enqueued_at: Option, - // Date to retrieve all tasks that were started before it. + /// Date to retrieve all tasks that were started before it. #[serde( skip_serializing_if = "Option::is_none", serialize_with = "time::serde::rfc3339::option::serialize" )] before_started_at: Option, - // Date to retrieve all tasks that were started after it. + /// Date to retrieve all tasks that were started after it. #[serde( skip_serializing_if = "Option::is_none", serialize_with = "time::serde::rfc3339::option::serialize" )] after_started_at: Option, - // Date to retrieve all tasks that were finished before it. + /// Date to retrieve all tasks that were finished before it. #[serde( skip_serializing_if = "Option::is_none", serialize_with = "time::serde::rfc3339::option::serialize" )] before_finished_at: Option, - // Date to retrieve all tasks that were finished after it. + /// Date to retrieve all tasks that were finished after it. #[serde( skip_serializing_if = "Option::is_none", serialize_with = "time::serde::rfc3339::option::serialize" @@ -552,7 +552,7 @@ pub struct TasksQuery<'a, T, Http: HttpClient> { #[serde(flatten)] pagination: T, - // Whether to reverse the sort + /// Whether to reverse the sort #[serde(skip_serializing_if = "Option::is_none")] reverse: Option, } From db4e9ed69b05b900963f2509a7701f05bf1a8dd5 Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Fri, 24 Jan 2025 22:56:41 +0100 Subject: [PATCH 2/3] Fix linking issues identified via cargo doc --- src/documents.rs | 2 +- src/dumps.rs | 2 +- src/lib.rs | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/documents.rs b/src/documents.rs index 17e2e610..bf98851f 100644 --- a/src/documents.rs +++ b/src/documents.rs @@ -1,7 +1,7 @@ use async_trait::async_trait; use serde::{de::DeserializeOwned, Deserialize, Serialize}; -/// Derive the [`IndexConfig`](crate::documents::IndexConfig) trait. +/// Derive the [`IndexConfig`] trait. /// /// ## Field attribute /// Use the `#[index_config(..)]` field attribute to generate the correct settings diff --git a/src/dumps.rs b/src/dumps.rs index e9b09373..8f91ecc4 100644 --- a/src/dumps.rs +++ b/src/dumps.rs @@ -6,7 +6,7 @@ //! //! - Creating a dump is also referred to as exporting it, whereas launching Meilisearch with a dump is referred to as importing it. //! -//! - During a [dump export](Client::create_dump), all [indexes](crate::indexes::Index) of the current instance are exported—together with their documents and settings—and saved as a single `.dump` file. +//! - During a [dump export](crate::client::Client::create_dump), all [indexes](crate::indexes::Index) of the current instance are exported—together with their documents and settings—and saved as a single `.dump` file. //! //! - During a dump import, all indexes contained in the indicated `.dump` file are imported along with their associated documents and [settings](crate::settings::Settings). //! Any existing [index](crate::indexes::Index) with the same uid as an index in the dump file will be overwritten. diff --git a/src/lib.rs b/src/lib.rs index 96e7bc88..c0e4a74a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -230,7 +230,7 @@ #![warn(clippy::all)] #![allow(clippy::needless_doctest_main)] -/// Module containing the [`Client`] struct. +/// Module containing the [`Client`](client::Client) struct. pub mod client; /// Module representing the [documents] structures. pub mod documents; @@ -242,18 +242,18 @@ pub mod errors; pub mod features; /// Module containing the Index struct. pub mod indexes; -/// Module containing the [`Key`] struct. +/// Module containing the [`Key`](key::Key) struct. pub mod key; pub mod request; /// Module related to search queries and results. pub mod search; -/// Module containing [`Settings`]. +/// Module containing [`Settings`](settings::Settings). pub mod settings; -/// Module containing the [snapshots] trait. +/// Module containing the [snapshots](snapshots::create_snapshot)-feature. pub mod snapshots; -/// Module representing the [`TaskInfo`]s. +/// Module representing the [`TaskInfo`](task_info::TaskInfo)s. pub mod task_info; -/// Module representing the [`Task`]s. +/// Module representing the [`Task`](tasks::Task)s. pub mod tasks; /// Module that generates tenant tokens. #[cfg(not(target_arch = "wasm32"))] From c34af95dd5db92dd5db0d8f3f3962a92de7e60f4 Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Mon, 27 Jan 2025 10:43:09 +0100 Subject: [PATCH 3/3] Fix clippy linting issue --- src/tenant_tokens.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tenant_tokens.rs b/src/tenant_tokens.rs index bb561f71..24052d41 100644 --- a/src/tenant_tokens.rs +++ b/src/tenant_tokens.rs @@ -29,7 +29,7 @@ pub fn generate_tenant_token( return Err(Error::InvalidUuid4Version); } - if expires_at.map_or(false, |expires_at| OffsetDateTime::now_utc() > expires_at) { + if expires_at.is_some_and(|expires_at| OffsetDateTime::now_utc() > expires_at) { return Err(Error::TenantTokensExpiredSignature); }