diff --git a/meli/src/mail/listing.rs b/meli/src/mail/listing.rs index 45fb0c96..a427d235 100644 --- a/meli/src/mail/listing.rs +++ b/meli/src/mail/listing.rs @@ -978,7 +978,7 @@ pub trait ListingTrait: Component { let d = std::time::UNIX_EPOCH + std::time::Duration::from_secs(epoch); let now: std::time::Duration = std::time::SystemTime::now() .duration_since(d) - .unwrap_or_else(|_| std::time::Duration::new(std::u64::MAX, 0)); + .unwrap_or_else(|_| std::time::Duration::new(u64::MAX, 0)); match now.as_secs() { n if context.settings.listing.recent_dates && n < 60 * 60 => format!( "{} minute{} ago", diff --git a/melib/src/email/attachments.rs b/melib/src/email/attachments.rs index 14c7bcde..d88f03d6 100644 --- a/melib/src/email/attachments.rs +++ b/melib/src/email/attachments.rs @@ -51,7 +51,7 @@ pub struct DecodeOptions<'att> { } impl<'att> From> for DecodeOptions<'att> { - fn from(force_charset: Option) -> DecodeOptions<'att> { + fn from(force_charset: Option) -> Self { Self { filter: None, force_charset, diff --git a/melib/src/email/list_management.rs b/melib/src/email/list_management.rs index a55da823..b54c5612 100644 --- a/melib/src/email/list_management.rs +++ b/melib/src/email/list_management.rs @@ -54,7 +54,7 @@ impl<'a> From<&'a [u8]> for ListAction<'a> { } impl<'a> ListAction<'a> { - pub fn parse_options_list(input: &'a [u8]) -> Option; 4]>> { + pub fn parse_options_list(input: &'a [u8]) -> Option> { parser::mailing_lists::rfc_2369_list_headers_action_list(input) .map(|(_, mut vec)| { /* Prefer email options first, since this _is_ a mail client after all and @@ -106,7 +106,7 @@ pub fn list_id(header: Option<&'_ str>) -> Option<&'_ str> { } impl<'a> ListActions<'a> { - pub fn detect(envelope: &'a Envelope) -> Option> { + pub fn detect(envelope: &'a Envelope) -> Option { let mut ret = Self { id: list_id_header(envelope), ..Self::default() diff --git a/melib/src/notmuch/message.rs b/melib/src/notmuch/message.rs index f4d6c3ba..157811a8 100644 --- a/melib/src/notmuch/message.rs +++ b/melib/src/notmuch/message.rs @@ -44,7 +44,7 @@ pub struct Message<'m> { } impl<'m> Message<'m> { - pub fn find_message(db: &'m DbConnection, msg_id: &CStr) -> Result> { + pub fn find_message(db: &'m DbConnection, msg_id: &CStr) -> Result { let mut message: *mut ffi::notmuch_message_t = std::ptr::null_mut(); let lib = db.lib.clone(); unsafe { @@ -54,7 +54,7 @@ impl<'m> Message<'m> { std::ptr::addr_of_mut!(message), ) }; - Ok(Message { + Ok(Self { lib, message: NonNull::new(message).ok_or_else(|| { Error::new(format!( diff --git a/melib/src/notmuch/tags.rs b/melib/src/notmuch/tags.rs index a138786e..06ae4aa0 100644 --- a/melib/src/notmuch/tags.rs +++ b/melib/src/notmuch/tags.rs @@ -41,8 +41,8 @@ impl Drop for TagIterator<'_> { } impl<'m> TagIterator<'m> { - pub fn new(message: &'m Message<'m>) -> TagIterator<'m> { - TagIterator { + pub fn new(message: &'m Message<'m>) -> Self { + Self { tags: NonNull::new(unsafe { call!(message.lib, notmuch_message_get_tags)(message.message.as_ptr()) }), @@ -127,6 +127,7 @@ impl<'m> TagIterator<'m> { impl<'m> Iterator for TagIterator<'m> { type Item = &'m CStr; + fn next(&mut self) -> Option { let tags = self.tags?; if unsafe { call!(self.message.lib, notmuch_tags_valid)(tags.as_ptr()) } == 1 { diff --git a/melib/src/text/line_break.rs b/melib/src/text/line_break.rs index 5a20864d..bc57534c 100644 --- a/melib/src/text/line_break.rs +++ b/melib/src/text/line_break.rs @@ -933,7 +933,7 @@ mod alg { } } let count = words.len(); - let mut minima = vec![std::usize::MAX - 1; count + 1]; + let mut minima = vec![usize::MAX - 1; count + 1]; minima[0] = 0; let mut offsets = Vec::with_capacity(words.len()); offsets.push(0);