diff --git a/melib/src/backends.rs b/melib/src/backends.rs index 9d4960d9..6acc6322 100644 --- a/melib/src/backends.rs +++ b/melib/src/backends.rs @@ -502,7 +502,7 @@ pub trait BackendOp: ::std::fmt::Debug + ::std::marker::Send { fn as_bytes(&mut self) -> ResultFuture>; } -/// Wrapper for BackendOps that are to be set read-only. +/// Wrapper for [`BackendOp`] that are to be set read-only. /// /// Warning: Backend implementations may still cause side-effects (for example /// IMAP can set the Seen flag when fetching an envelope) diff --git a/melib/src/email/address.rs b/melib/src/email/address.rs index ff128173..c53b7b1b 100644 --- a/melib/src/email/address.rs +++ b/melib/src/email/address.rs @@ -20,7 +20,7 @@ */ //! Email addresses. Parsing functions are in -//! [melib::email::parser::address](super::parser::address). +//! [`crate::email::parser::address`]. use std::{ collections::HashSet, convert::TryFrom, diff --git a/melib/src/email/attachments.rs b/melib/src/email/attachments.rs index e3b6ffe4..167c5d55 100644 --- a/melib/src/email/attachments.rs +++ b/melib/src/email/attachments.rs @@ -134,7 +134,7 @@ impl AttachmentBuilder { /// Set body to the entire raw contents, use this if raw contains only data /// and no headers If raw contains data and headers pass it through - /// AttachmentBuilder::new(). + /// [`AttachmentBuilder::new`]. pub fn set_body_to_raw(&mut self) -> &mut Self { self.body = StrBuilder { offset: 0, diff --git a/melib/src/email/compose.rs b/melib/src/email/compose.rs index 40cdd16e..ee38c30a 100644 --- a/melib/src/email/compose.rs +++ b/melib/src/email/compose.rs @@ -19,7 +19,7 @@ * along with meli. If not, see . */ -//! Compose a [``Draft`], with `MIME` and attachment support. +//! Compose a [`Draft`], with `MIME` and attachment support. use std::{ convert::TryFrom, ffi::OsStr, @@ -542,7 +542,7 @@ fn print_attachment(ret: &mut String, a: AttachmentBuilder) { } /// Reads file from given path, and returns an 'application/octet-stream' -/// AttachmentBuilder object +/// [`AttachmentBuilder`] object pub fn attachment_from_file(path: &I) -> Result where I: AsRef, diff --git a/melib/src/email/headers.rs b/melib/src/email/headers.rs index 6cc672fd..a63cf50c 100644 --- a/melib/src/email/headers.rs +++ b/melib/src/email/headers.rs @@ -76,7 +76,7 @@ impl<'a> Borrow for HeaderName { /// - `usize` /// - `&[u8]`, which panics if it's not a valid header value. /// - `&str`, which also panics if it's not a valid header value. -/// - [HeaderName], which is guaranteed to be valid. +/// - [`HeaderName`], which is guaranteed to be valid. /// /// # Panics /// diff --git a/melib/src/email/parser.rs b/melib/src/email/parser.rs index b03f77d7..879493ef 100644 --- a/melib/src/email/parser.rs +++ b/melib/src/email/parser.rs @@ -1402,10 +1402,12 @@ pub mod generic { Ok((input, ret.into())) } - ///`atext = ALPHA / DIGIT / ; Printable US-ASCII "!" / "#" / + ///```text + /// atext = ALPHA / DIGIT / ; Printable US-ASCII "!" / "#" / /// ; characters not including "$" / "%" / ; specials. Used for /// atoms. "&" / "'" / "*" / "+" / "-" / "/" / "=" / "?" / "^" / "_" / "`" - /// / "{" / "|" / "}" / "~"` + /// / "{" / "|" / "}" / "~" + /// ``` pub fn atext_ascii(input: &[u8]) -> IResult<&[u8], Cow<'_, [u8]>> { if input.is_empty() { return Err(nom::Err::Error((input, "atext(): empty input").into())); diff --git a/melib/src/email/pgp.rs b/melib/src/email/pgp.rs index d9ea6ca8..63cebd9c 100644 --- a/melib/src/email/pgp.rs +++ b/melib/src/email/pgp.rs @@ -19,7 +19,7 @@ * along with meli. If not, see . */ -//! Verification of OpenPGP signatures. +//! Verification of `OpenPGP` signatures. use crate::{ email::{ attachment_types::{ContentType, MultipartType}, diff --git a/melib/src/imap/cache/sync.rs b/melib/src/imap/cache/sync.rs index 9b86fa99..580e2f56 100644 --- a/melib/src/imap/cache/sync.rs +++ b/melib/src/imap/cache/sync.rs @@ -79,7 +79,7 @@ impl ImapConnection { } } - /// > rfc4549_Synchronization_Operations_for_Disconnected_IMAP4_Clients + /// RFC4549 Synchronization Operations for Disconnected IMAP4 Clients pub async fn resync_basic( &mut self, mut cache_handle: Box, @@ -311,7 +311,7 @@ impl ImapConnection { Ok(Some(payload.into_iter().map(|(_, env)| env).collect())) } - /// > rfc4549_Synchronization_Operations_for_Disconnected_IMAP4_Clients + /// RFC4549 Synchronization Operations for Disconnected IMAP4 Clients /// > Section 6.1 pub async fn resync_condstore( &mut self, @@ -621,9 +621,8 @@ impl ImapConnection { Ok(Some(payload.into_iter().map(|(_, env)| env).collect())) } - /// > rfc7162_Quick Flag Changes Resynchronization (CONDSTORE)_and Quick - /// > Mailbox - /// > Resynchronization (QRESYNC) + /// RFC7162 Quick Flag Changes Resynchronization (CONDSTORE) and Quick + /// Mailbox Resynchronization (QRESYNC) pub async fn resync_condstoreqresync( &mut self, _cache_handle: Box, diff --git a/melib/src/jmap/objects/mailbox.rs b/melib/src/jmap/objects/mailbox.rs index d1d13f8e..08885286 100644 --- a/melib/src/jmap/objects/mailbox.rs +++ b/melib/src/jmap/objects/mailbox.rs @@ -99,7 +99,7 @@ impl Method for MailboxGet { /// Section 5.3 but with the following additional request argument: /// /// -/// The following extra SetError types are defined: +/// The following extra [`SetError`] types are defined: /// /// For `destroy`: /// diff --git a/melib/src/jmap/objects/submission.rs b/melib/src/jmap/objects/submission.rs index 50a4c03c..9a6e3e4e 100644 --- a/melib/src/jmap/objects/submission.rs +++ b/melib/src/jmap/objects/submission.rs @@ -60,9 +60,9 @@ pub enum UndoStatus { /// This represents the delivery status for each of the submission's /// recipients, if known. This property MAY not be supported by all /// servers, in which case it will remain null. Servers that support -/// it SHOULD update the EmailSubmission object each time the status -/// of any of the recipients changes, even if some recipients are -/// still being retried. +/// it SHOULD update the [`EmailSubmission`](`EmailSubmissionObject`) object +/// each time the status of any of the recipients changes, even if some +/// recipients are still being retried. #[derive(Clone, Debug, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct DeliveryStatusObject { @@ -175,7 +175,7 @@ pub enum Delivered { /// # Email Submission /// -/// An *EmailSubmission* object represents the submission of an Email for +/// An `EmailSubmission` object represents the submission of an Email for /// delivery to one or more recipients. It has the following properties: #[derive(Clone, Debug, Deserialize)] #[serde(rename_all = "camelCase")] @@ -299,11 +299,11 @@ pub struct EmailSubmissionSet { #[serde(default)] pub on_success_update_email: Option, PatchObject>>, /// onSuccessDestroyEmail: `Id[]|null` - /// A list of EmailSubmission ids for which the Email with the + /// A list of [`EmailSubmissionObject`] ids for which the Email with the /// corresponding `emailId` should be destroyed if the create/update/ - /// destroy succeeds. (For references to EmailSubmission creations, - /// this is equivalent to a creation-reference, so the id will be the - /// creation id prefixed with a `#`.) + /// destroy succeeds. (For references to [`EmailSubmissionObject`] + /// creations, this is equivalent to a creation-reference, so the id + /// will be the creation id prefixed with a `#`.) #[serde(default)] pub on_success_destroy_email: Option>>, } @@ -353,9 +353,9 @@ pub struct EnvelopeObject { /// When a JMAP server performs an SMTP message submission, it MAY /// use the same id string for the ENVID parameter `[RFC3461]` and - /// the EmailSubmission object id. Servers that do this MAY - /// replace a client-provided value for ENVID with a server- - /// provided value. + /// the [`EmailSubmission`](`EmailSubmissionObject`) object id. Servers + /// that do this MAY replace a client-provided value for ENVID with a + /// server- provided value. pub mail_from: Address, /// The email addresses to send the message to, and any RCPT TO diff --git a/melib/src/lib.rs b/melib/src/lib.rs index de4a2a95..9dc0e6d6 100644 --- a/melib/src/lib.rs +++ b/melib/src/lib.rs @@ -41,6 +41,8 @@ //clippy::cast_possible_wrap, //clippy::ptr_as_ptr, //clippy::bool_to_int_with_if, + clippy::doc_markdown, + clippy::expect_fun_call, clippy::borrow_as_ptr, clippy::case_sensitive_file_extension_comparisons, //clippy::cast_lossless, diff --git a/melib/src/mbox/mod.rs b/melib/src/mbox/mod.rs index 2a2646f6..6bb0b21f 100644 --- a/melib/src/mbox/mod.rs +++ b/melib/src/mbox/mod.rs @@ -72,7 +72,7 @@ //! //! ## Metadata //! -//! `melib` recognizes the CClient (a [Pine client API](https://web.archive.org/web/20050203003235/http://www.washington.edu/imap/)) convention for metadata in `mbox` format: +//! `melib` recognizes the `CClient` (a [Pine client API](https://web.archive.org/web/20050203003235/http://www.washington.edu/imap/)) convention for metadata in `mbox` format: //! //! - `Status`: R (Seen) and O (non-Recent) flags //! - `X-Status`: A (Answered), F (Flagged), T (Draft) and D (Deleted) flags diff --git a/melib/src/notmuch/ffi.rs b/melib/src/notmuch/ffi.rs index c2bd1757..6f8c8eda 100644 --- a/melib/src/notmuch/ffi.rs +++ b/melib/src/notmuch/ffi.rs @@ -1,5 +1,6 @@ #![allow(non_camel_case_types)] #![allow(non_upper_case_globals)] +#![allow(clippy::doc_markdown)] use libc::time_t; /* automatically generated by rust-bindgen */ @@ -8,12 +9,12 @@ pub type __syscall_slong_t = ::std::os::raw::c_long; /// Notmuch boolean type. pub type notmuch_bool_t = ::std::os::raw::c_int; /// No error occurred. -pub const _notmuch_status_NOTMUCH_STATUS_SUCCESS: _notmuch_status = 0; +pub const NOTMUCH_STATUS_SUCCESS: _notmuch_status = 0; /// Out of memory. -pub const _notmuch_status_NOTMUCH_STATUS_OUT_OF_MEMORY: _notmuch_status = 1; +pub const NOTMUCH_STATUS_OUT_OF_MEMORY: _notmuch_status = 1; /// An attempt was made to write to a database opened in read-only /// mode. -pub const _notmuch_status_NOTMUCH_STATUS_READ_ONLY_DATABASE: _notmuch_status = 2; +pub const NOTMUCH_STATUS_READ_ONLY_DATABASE: _notmuch_status = 2; /// A Xapian exception occurred. /// /// ```text @@ -21,54 +22,54 @@ pub const _notmuch_status_NOTMUCH_STATUS_READ_ONLY_DATABASE: _notmuch_status = 2 /// value. Instead we should map to things like DATABASE_LOCKED or /// whatever. /// ``` -pub const _notmuch_status_NOTMUCH_STATUS_XAPIAN_EXCEPTION: _notmuch_status = 3; +pub const NOTMUCH_STATUS_XAPIAN_EXCEPTION: _notmuch_status = 3; /// An error occurred trying to read or write to a file (this could /// be file not found, permission denied, etc.) -pub const _notmuch_status_NOTMUCH_STATUS_FILE_ERROR: _notmuch_status = 4; +pub const NOTMUCH_STATUS_FILE_ERROR: _notmuch_status = 4; /// A file was presented that doesn't appear to be an email /// message. -pub const _notmuch_status_NOTMUCH_STATUS_FILE_NOT_EMAIL: _notmuch_status = 5; +pub const NOTMUCH_STATUS_FILE_NOT_EMAIL: _notmuch_status = 5; /// A file contains a message ID that is identical to a message /// already in the database. -pub const _notmuch_status_NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID: _notmuch_status = 6; +pub const NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID: _notmuch_status = 6; /// The user erroneously passed a NULL pointer to a notmuch /// function. -pub const _notmuch_status_NOTMUCH_STATUS_NULL_POINTER: _notmuch_status = 7; +pub const NOTMUCH_STATUS_NULL_POINTER: _notmuch_status = 7; /// A tag value is too long (exceeds NOTMUCH_TAG_MAX). -pub const _notmuch_status_NOTMUCH_STATUS_TAG_TOO_LONG: _notmuch_status = 8; +pub const NOTMUCH_STATUS_TAG_TOO_LONG: _notmuch_status = 8; /// The notmuch_message_thaw function has been called more times /// than notmuch_message_freeze. -pub const _notmuch_status_NOTMUCH_STATUS_UNBALANCED_FREEZE_THAW: _notmuch_status = 9; +pub const NOTMUCH_STATUS_UNBALANCED_FREEZE_THAW: _notmuch_status = 9; /// notmuch_database_end_atomic has been called more times than /// notmuch_database_begin_atomic. -pub const _notmuch_status_NOTMUCH_STATUS_UNBALANCED_ATOMIC: _notmuch_status = 10; +pub const NOTMUCH_STATUS_UNBALANCED_ATOMIC: _notmuch_status = 10; /// The operation is not supported. -pub const _notmuch_status_NOTMUCH_STATUS_UNSUPPORTED_OPERATION: _notmuch_status = 11; +pub const NOTMUCH_STATUS_UNSUPPORTED_OPERATION: _notmuch_status = 11; /// The operation requires a database upgrade. -pub const _notmuch_status_NOTMUCH_STATUS_UPGRADE_REQUIRED: _notmuch_status = 12; +pub const NOTMUCH_STATUS_UPGRADE_REQUIRED: _notmuch_status = 12; /// There is a problem with the proposed path, e.g. a relative path /// passed to a function expecting an absolute path. -pub const _notmuch_status_NOTMUCH_STATUS_PATH_ERROR: _notmuch_status = 13; +pub const NOTMUCH_STATUS_PATH_ERROR: _notmuch_status = 13; /// The requested operation was ignored. Depending on the function, /// this may not be an actual error. -pub const _notmuch_status_NOTMUCH_STATUS_IGNORED: _notmuch_status = 14; +pub const NOTMUCH_STATUS_IGNORED: _notmuch_status = 14; /// One of the arguments violates the preconditions for the /// function, in a way not covered by a more specific argument. -pub const _notmuch_status_NOTMUCH_STATUS_ILLEGAL_ARGUMENT: _notmuch_status = 15; +pub const NOTMUCH_STATUS_ILLEGAL_ARGUMENT: _notmuch_status = 15; /// A MIME object claimed to have cryptographic protection which /// notmuch tried to handle, but the protocol was not specified in /// an intelligible way. -pub const _notmuch_status_NOTMUCH_STATUS_MALFORMED_CRYPTO_PROTOCOL: _notmuch_status = 16; +pub const NOTMUCH_STATUS_MALFORMED_CRYPTO_PROTOCOL: _notmuch_status = 16; /// Notmuch attempted to do crypto processing, but could not /// initialize the engine needed to do so. -pub const _notmuch_status_NOTMUCH_STATUS_FAILED_CRYPTO_CONTEXT_CREATION: _notmuch_status = 17; +pub const NOTMUCH_STATUS_FAILED_CRYPTO_CONTEXT_CREATION: _notmuch_status = 17; /// A MIME object claimed to have cryptographic protection, and /// notmuch attempted to process it, but the specific protocol was /// something that notmuch doesn't know how to handle. -pub const _notmuch_status_NOTMUCH_STATUS_UNKNOWN_CRYPTO_PROTOCOL: _notmuch_status = 18; +pub const NOTMUCH_STATUS_UNKNOWN_CRYPTO_PROTOCOL: _notmuch_status = 18; /// Not an actual status value. Just a way to find out how many /// valid status values there are. -pub const _notmuch_status_NOTMUCH_STATUS_LAST_STATUS: _notmuch_status = 19; +pub const NOTMUCH_STATUS_LAST_STATUS: _notmuch_status = 19; /// /// A zero value (NOTMUCH_STATUS_SUCCESS) indicates that the function /// completed without error. Any other value indicates an error. @@ -192,9 +193,9 @@ pub type notmuch_database_create_verbose = unsafe extern "C" fn( ) -> notmuch_status_t; /// Open database for reading only. -pub const notmuch_database_mode_t_NOTMUCH_DATABASE_MODE_READ_ONLY: notmuch_database_mode_t = 0; +pub const NOTMUCH_DATABASE_MODE_READ_ONLY: notmuch_database_mode_t = 0; /// Open database for reading and writing. -pub const notmuch_database_mode_t_NOTMUCH_DATABASE_MODE_READ_WRITE: notmuch_database_mode_t = 1; +pub const NOTMUCH_DATABASE_MODE_READ_WRITE: notmuch_database_mode_t = 1; /// Database open mode for notmuch_database_open. pub type notmuch_database_mode_t = u32; /// Open an existing notmuch database located at 'path'. @@ -640,13 +641,13 @@ pub type notmuch_query_create = unsafe extern "C" fn( ) -> *mut notmuch_query_t; /// Oldest first. -pub const notmuch_sort_t_NOTMUCH_SORT_OLDEST_FIRST: notmuch_sort_t = 0; +pub const NOTMUCH_SORT_OLDEST_FIRST: notmuch_sort_t = 0; /// Newest first. -pub const notmuch_sort_t_NOTMUCH_SORT_NEWEST_FIRST: notmuch_sort_t = 1; +pub const NOTMUCH_SORT_NEWEST_FIRST: notmuch_sort_t = 1; /// Sort by message-id. -pub const notmuch_sort_t_NOTMUCH_SORT_MESSAGE_ID: notmuch_sort_t = 2; +pub const NOTMUCH_SORT_MESSAGE_ID: notmuch_sort_t = 2; /// Do not sort. -pub const notmuch_sort_t_NOTMUCH_SORT_UNSORTED: notmuch_sort_t = 3; +pub const NOTMUCH_SORT_UNSORTED: notmuch_sort_t = 3; /// Sort values for notmuch_query_set_sort. pub type notmuch_sort_t = u32; /// Return the query_string of this query. See notmuch_query_create. @@ -657,9 +658,9 @@ pub type notmuch_query_get_query_string = pub type notmuch_query_get_database = unsafe extern "C" fn(query: *const notmuch_query_t) -> *mut notmuch_database_t; -pub const notmuch_exclude_t_NOTMUCH_EXCLUDE_FLAG: notmuch_exclude_t = 0; -pub const notmuch_exclude_t_NOTMUCH_EXCLUDE_TRUE: notmuch_exclude_t = 1; -pub const notmuch_exclude_t_NOTMUCH_EXCLUDE_FALSE: notmuch_exclude_t = 2; +pub const NOTMUCH_EXCLUDE_FLAG: notmuch_exclude_t = 0; +pub const NOTMUCH_EXCLUDE_TRUE: notmuch_exclude_t = 1; +pub const NOTMUCH_EXCLUDE_FALSE: notmuch_exclude_t = 2; pub const notmuch_exclude_t_NOTMUCH_EXCLUDE_ALL: notmuch_exclude_t = 3; /// Exclude values for notmuch_query_set_omit_excluded. The strange /// order is to maintain backward compatibility: the old FALSE/TRUE @@ -1260,9 +1261,9 @@ pub type notmuch_message_reindex = unsafe extern "C" fn( indexopts: *mut notmuch_indexopts_t, ) -> notmuch_status_t; -pub const _notmuch_message_flag_NOTMUCH_MESSAGE_FLAG_MATCH: _notmuch_message_flag = 0; -pub const _notmuch_message_flag_NOTMUCH_MESSAGE_FLAG_EXCLUDED: _notmuch_message_flag = 1; -pub const _notmuch_message_flag_NOTMUCH_MESSAGE_FLAG_GHOST: _notmuch_message_flag = 2; +pub const NOTMUCH_MESSAGE_FLAG_MATCH: _notmuch_message_flag = 0; +pub const NOTMUCH_MESSAGE_FLAG_EXCLUDED: _notmuch_message_flag = 1; +pub const NOTMUCH_MESSAGE_FLAG_GHOST: _notmuch_message_flag = 2; /// Message flags. pub type _notmuch_message_flag = u32; pub use self::_notmuch_message_flag as notmuch_message_flag_t; @@ -2029,10 +2030,10 @@ pub type notmuch_config_list_destroy = pub type notmuch_database_get_default_indexopts = unsafe extern "C" fn(db: *mut notmuch_database_t) -> *mut notmuch_indexopts_t; -pub const notmuch_decryption_policy_t_NOTMUCH_DECRYPT_FALSE: notmuch_decryption_policy_t = 0; -pub const notmuch_decryption_policy_t_NOTMUCH_DECRYPT_TRUE: notmuch_decryption_policy_t = 1; -pub const notmuch_decryption_policy_t_NOTMUCH_DECRYPT_AUTO: notmuch_decryption_policy_t = 2; -pub const notmuch_decryption_policy_t_NOTMUCH_DECRYPT_NOSTASH: notmuch_decryption_policy_t = 3; +pub const NOTMUCH_DECRYPT_FALSE: notmuch_decryption_policy_t = 0; +pub const NOTMUCH_DECRYPT_TRUE: notmuch_decryption_policy_t = 1; +pub const NOTMUCH_DECRYPT_AUTO: notmuch_decryption_policy_t = 2; +pub const NOTMUCH_DECRYPT_NOSTASH: notmuch_decryption_policy_t = 3; /// Stating a policy about how to decrypt messages. /// /// See index.decrypt in notmuch-config(1) for more details. diff --git a/melib/src/notmuch/message.rs b/melib/src/notmuch/message.rs index 1e938818..f4d6c3ba 100644 --- a/melib/src/notmuch/message.rs +++ b/melib/src/notmuch/message.rs @@ -24,13 +24,12 @@ use std::{cell::Cell, marker::PhantomData, ptr::NonNull}; use super::*; use crate::{ notmuch::ffi::{ - _notmuch_status_NOTMUCH_STATUS_READ_ONLY_DATABASE, - _notmuch_status_NOTMUCH_STATUS_UNBALANCED_FREEZE_THAW, notmuch_database_find_message, - notmuch_message_add_tag, notmuch_message_destroy, notmuch_message_freeze, - notmuch_message_get_date, notmuch_message_get_filename, notmuch_message_get_header, - notmuch_message_get_message_id, notmuch_message_get_replies, notmuch_message_remove_tag, - notmuch_message_tags_to_maildir_flags, notmuch_message_thaw, notmuch_messages_get, - notmuch_messages_move_to_next, notmuch_messages_valid, + notmuch_database_find_message, notmuch_message_add_tag, notmuch_message_destroy, + notmuch_message_freeze, notmuch_message_get_date, notmuch_message_get_filename, + notmuch_message_get_header, notmuch_message_get_message_id, notmuch_message_get_replies, + notmuch_message_remove_tag, notmuch_message_tags_to_maildir_flags, notmuch_message_thaw, + notmuch_messages_get, notmuch_messages_move_to_next, notmuch_messages_valid, + NOTMUCH_STATUS_READ_ONLY_DATABASE, NOTMUCH_STATUS_UNBALANCED_FREEZE_THAW, }, thread::{ThreadHash, ThreadNode, ThreadNodeHash}, }; @@ -260,7 +259,8 @@ impl<'m> Message<'m> { /// Quoted from `libnotmuch` C header: /// /// > The returned filename is an absolute filename, (the initial - /// > component will match `notmuch_database_get_path()`). + /// > component will match + /// > [`notmuch_database_get_path`](crate::notmuch::ffi::notmuch_database_get_path)). /// > /// > The returned string belongs to the message so should not be /// > modified or freed by the caller (nor should it be referenced after @@ -269,7 +269,9 @@ impl<'m> Message<'m> { /// > Note: If this message corresponds to multiple files in the mail /// > store, (that is, multiple files contain identical message IDs), /// > this function will arbitrarily return a single one of those - /// > filenames. See `notmuch_message_get_filenames` for returning the + /// > filenames. See + /// > [`notmuch_message_get_filenames`](crate::notmuch::ffi::notmuch_message_get_filenames) + /// > for returning the /// > complete list of filenames. #[doc(alias = "notmuch_message_get_filename")] pub fn get_filename(&self) -> &OsStr { @@ -284,9 +286,10 @@ impl<'m> Message<'m> { /// Quoted from `libnotmuch` C header: /// /// > This means that changes to the message state, (via - /// > notmuch_message_add_tag, notmuch_message_remove_tag, and - /// > notmuch_message_remove_all_tags), will not be committed to the - /// > database until the message is thawed with notmuch_message_thaw. + /// > [`notmuch_message_add_tag`], [`notmuch_message_remove_tag`](, and + /// > [`notmuch_message_remove_all_tags`](crate::notmuch::ffi::notmuch_message_remove_all_tags)), will not be committed to the + /// > database until the message is thawed with + /// > [`notmuch_message_thaw`]. /// > /// > Multiple calls to freeze/thaw are valid and these calls will /// > "stack". That is there must be as many calls to thaw as to freeze @@ -314,17 +317,17 @@ impl<'m> Message<'m> { /// > Imagine the example above without freeze/thaw and the operation /// > somehow getting interrupted. This could result in the message being /// > left with no tags if the interruption happened after - /// > notmuch_message_remove_all_tags but before notmuch_message_add_tag. + /// > [`notmuch_message_remove_all_tags`](crate::notmuch::ffi::notmuch_message_remove_all_tags) but before [`notmuch_message_add_tag`]. /// > /// > Return value: /// > - /// > - `NOTMUCH_STATUS_SUCCESS`: Message successfully frozen. - /// > - `NOTMUCH_STATUS_READ_ONLY_DATABASE`: Database was opened in + /// > - [`NOTMUCH_STATUS_SUCCESS`](crate::notmuch::ffi::NOTMUCH_STATUS_SUCCESS): Message successfully frozen. + /// > - [`NOTMUCH_STATUS_READ_ONLY_DATABASE`]: Database was opened in /// > read-only /// > mode so message cannot be modified. #[doc(alias = "notmuch_message_freeze")] pub fn freeze(&self) { - if _notmuch_status_NOTMUCH_STATUS_READ_ONLY_DATABASE + if NOTMUCH_STATUS_READ_ONLY_DATABASE == unsafe { call!(self.lib, notmuch_message_freeze)(self.message.as_ptr()) } { return; @@ -347,19 +350,23 @@ impl<'m> Message<'m> { /// > /// > Return value: /// > - /// > - `NOTMUCH_STATUS_SUCCESS`: Message successfully thawed, (or at least + /// > - [`NOTMUCH_STATUS_SUCCESS`](crate::notmuch::ffi::NOTMUCH_STATUS_SUCCESS): Message successfully thawed, (or at + /// > least /// > its frozen count has successfully been reduced by 1). - /// > - `NOTMUCH_STATUS_UNBALANCED_FREEZE_THAW`: An attempt was made to thaw + /// > - [`NOTMUCH_STATUS_UNBALANCED_FREEZE_THAW`]: An attempt was made to + /// > thaw /// > an unfrozen message. That is, there have been an unbalanced - /// > number of calls to `notmuch_message_freeze` and - /// > `notmuch_message_thaw`. + /// > number of calls to + /// > [`notmuch_message_freeze`] + /// > and + /// > [`notmuch_message_thaw`]. #[doc(alias = "notmuch_message_thaw")] pub fn thaw(&self) { if self.freezes.get() == 0 { return; } - if _notmuch_status_NOTMUCH_STATUS_UNBALANCED_FREEZE_THAW + if NOTMUCH_STATUS_UNBALANCED_FREEZE_THAW == unsafe { call!(self.lib, notmuch_message_thaw)(self.message.as_ptr()) } { return; diff --git a/melib/src/notmuch/mod.rs b/melib/src/notmuch/mod.rs index a60a34fc..1994293b 100644 --- a/melib/src/notmuch/mod.rs +++ b/melib/src/notmuch/mod.rs @@ -59,7 +59,7 @@ macro_rules! call { macro_rules! try_call { ($lib:expr, $call:expr) => {{ let status = $call; - if status == $crate::notmuch::ffi::_notmuch_status_NOTMUCH_STATUS_SUCCESS { + if status == $crate::notmuch::ffi::NOTMUCH_STATUS_SUCCESS { Ok(()) } else { let c_str = call!($lib, notmuch_status_to_string)(status); @@ -505,9 +505,9 @@ impl NotmuchDb { call!(lib, notmuch_database_open)( path_ptr, if write { - ffi::notmuch_database_mode_t_NOTMUCH_DATABASE_MODE_READ_WRITE + ffi::NOTMUCH_DATABASE_MODE_READ_WRITE } else { - ffi::notmuch_database_mode_t_NOTMUCH_DATABASE_MODE_READ_ONLY + ffi::NOTMUCH_DATABASE_MODE_READ_ONLY }, std::ptr::addr_of_mut!(database), ) diff --git a/melib/src/notmuch/thread.rs b/melib/src/notmuch/thread.rs index 6a30bf78..4e53a726 100644 --- a/melib/src/notmuch/thread.rs +++ b/melib/src/notmuch/thread.rs @@ -110,11 +110,12 @@ impl Drop for Thread<'_> { /// Quoting the docs: /// /// > Note that there's no explicit destructor needed for the -/// > notmuch_threads_t object. (For consistency, we do provide a -/// > notmuch_threads_destroy function, but there's no good reason +/// > [`notmuch_threads_t`] object. (For consistency, we do provide a +/// > [`notmuch_threads_destroy`][crate::notmuch::ffi::notmuch_threads_destroy] +/// > function, but there's no good reason /// > to call it if the query is about to be destroyed). /// -/// So there's no need to implement Drop for this type. +/// So there's no need to implement [`Drop`] for this type. pub struct ThreadsIterator<'query> { pub lib: Arc, pub inner: Option>, diff --git a/melib/src/text/line_break.rs b/melib/src/text/line_break.rs index e027f681..e4e7e269 100644 --- a/melib/src/text/line_break.rs +++ b/melib/src/text/line_break.rs @@ -101,7 +101,7 @@ macro_rules! get_class { }}; } -/// Side effects: Updates $graph_iter and potentially $idx and $grapheme +/// Side effects: Updates `$graph_iter` and potentially `$idx` and `$grapheme` macro_rules! next_grapheme_class { ($graph_iter:ident, $grapheme:ident) => ({ if let Some((_, g)) = $graph_iter.next() { diff --git a/melib/src/thread.rs b/melib/src/thread.rs index 00af2cc7..4935aab2 100644 --- a/melib/src/thread.rs +++ b/melib/src/thread.rs @@ -815,7 +815,7 @@ impl Threads { } } - /// Update show_subject details of ThreadNode + /// Update `show_subject` details of [`ThreadNode`]. pub fn update_show_subject( &mut self, id: ThreadNodeHash, diff --git a/melib/src/utils/percent_encoding.rs b/melib/src/utils/percent_encoding.rs index af7468e8..15f9ed92 100644 --- a/melib/src/utils/percent_encoding.rs +++ b/melib/src/utils/percent_encoding.rs @@ -497,7 +497,7 @@ fn decode_utf8_lossy(input: Cow<'_, [u8]>) -> Cow<'_, str> { #[cfg(test)] mod tests { use super::*; - /// https://url.spec.whatwg.org/#fragment-percent-encode-set + /// const FRAGMENT: &AsciiSet = &NON_ALPHANUMERIC .add(b' ') .add(b'"') diff --git a/melib/src/utils/xdg/mod.rs b/melib/src/utils/xdg/mod.rs index 2d236e4d..6063676f 100644 --- a/melib/src/utils/xdg/mod.rs +++ b/melib/src/utils/xdg/mod.rs @@ -23,12 +23,10 @@ //! `xdg-utils`. //! //! # What is implemented? -//! * Function query_default_app performs -//! like the xdg-utils function `binary_to_desktop_file` -//! * Function query_mime_info launches the -//! `mimetype` or else the `file` command. +//! * Function [`query_default_app`] performs like the `xdg-utils` function +//! `binary_to_desktop_file`. +//! * Function [`query_mime_info`] launches the `mimetype` or else the `file` +//! command. //! //! Some of the utils may be implemented by combining these functions with other //! functions in the Rust standard library.