Fix new 1.79.0 clippy lints

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
pull/421/head
Manos Pitsidianakis 4 months ago
parent 7856ea33f0
commit ff3fe07758
No known key found for this signature in database
GPG Key ID: 7729C7707F7E09D0

@ -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",

@ -51,7 +51,7 @@ pub struct DecodeOptions<'att> {
}
impl<'att> From<Option<Charset>> for DecodeOptions<'att> {
fn from(force_charset: Option<Charset>) -> DecodeOptions<'att> {
fn from(force_charset: Option<Charset>) -> Self {
Self {
filter: None,
force_charset,

@ -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<SmallVec<[ListAction<'a>; 4]>> {
pub fn parse_options_list(input: &'a [u8]) -> Option<SmallVec<[Self; 4]>> {
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<ListActions<'a>> {
pub fn detect(envelope: &'a Envelope) -> Option<Self> {
let mut ret = Self {
id: list_id_header(envelope),
..Self::default()

@ -44,7 +44,7 @@ pub struct Message<'m> {
}
impl<'m> Message<'m> {
pub fn find_message(db: &'m DbConnection, msg_id: &CStr) -> Result<Message<'m>> {
pub fn find_message(db: &'m DbConnection, msg_id: &CStr) -> Result<Self> {
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!(

@ -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<Self::Item> {
let tags = self.tags?;
if unsafe { call!(self.message.lib, notmuch_tags_valid)(tags.as_ptr()) } == 1 {

@ -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);

Loading…
Cancel
Save