clippy: fix new warnings for 1.78.0

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
pull/384/head
Manos Pitsidianakis 2024-05-04 11:19:32 +03:00
parent 36b7c00b97
commit ab04189887
Signed by: Manos Pitsidianakis
GPG Key ID: 7729C7707F7E09D0
6 changed files with 40 additions and 35 deletions

View File

@ -610,7 +610,7 @@ impl Settings {
for (id, x) in fs.accounts {
let mut ac = AccountConf::from(x);
ac.account.name = id.clone();
ac.account.name.clone_from(&id);
s.insert(id, ac);
}

View File

@ -717,7 +717,7 @@ impl Component for StatusBar {
self.dirty = true;
}
UIEvent::StatusEvent(StatusEvent::BufSet(s)) => {
self.display_buffer = s.clone();
self.display_buffer.clone_from(s);
self.dirty = true;
}
UIEvent::StatusEvent(StatusEvent::UpdateStatus(ref mut s)) => {

View File

@ -70,7 +70,7 @@ pub fn parse_mutt_contact<'a>() -> impl Parser<'a, Card> {
});
name.pop();
if name.trim().is_empty() {
name = title.clone();
name.clone_from(&title);
}
ret.set_title(title).set_email(email).set_name(name);
Ok::<Card, &'a str>(ret)

View File

@ -106,17 +106,18 @@ impl std::fmt::Debug for ParsingError<&'_ str> {
}
}
struct DebugOkWrapper<'r, I, R: AsRef<[u8]>>(&'r IResult<I, R>);
// For debugging.
// struct DebugOkWrapper<'r, I, R: AsRef<[u8]>>(&'r IResult<I, R>);
impl<R: AsRef<[u8]> + std::fmt::Debug> std::fmt::Debug for DebugOkWrapper<'_, &'_ [u8], R> {
fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
if let Ok((a, b)) = self.0 {
write!(fmt, "Ok({}, {})", &to_str!(a), &to_str!(b.as_ref()))
} else {
write!(fmt, "{:?}", self.0)
}
}
}
// impl<R: AsRef<[u8]> + std::fmt::Debug> std::fmt::Debug for DebugOkWrapper<'_,
// &'_ [u8], R> { fn fmt(&self, fmt: &mut std::fmt::Formatter) ->
// std::fmt::Result { if let Ok((a, b)) = self.0 {
// write!(fmt, "Ok({}, {})", &to_str!(a), &to_str!(b.as_ref()))
// } else {
// write!(fmt, "{:?}", self.0)
// }
// }
// }
pub type IResult<I, O, E = ParsingError<I>> = std::result::Result<(I, O), nom::Err<E>>;
@ -2156,7 +2157,7 @@ pub mod encodings {
let s: Vec<u8> = match input[tag_end_idx + 1] {
b'b' | b'B' => BASE64_MIME
.decode(encoded_text)
.map_or_else(|_| encoded_text.to_vec(), |v| v),
.unwrap_or_else(|_| encoded_text.to_vec()),
b'q' | b'Q' => match quoted_printable_bytes_header(encoded_text) {
Ok((b"", s)) => s,
_ => {

View File

@ -229,7 +229,11 @@ impl JmapConnection {
return Err(err);
}
*self.store.core_capabilities.lock().unwrap() = session.capabilities.clone();
self.store
.core_capabilities
.lock()
.unwrap()
.clone_from(&session.capabilities);
let mail_account_id = session.mail_account_id();
_ = self
.store

View File

@ -1480,28 +1480,28 @@ fn print_threadnodes(
}
*/
#[derive(Serialize)]
struct Node {
id: String,
subject: String,
from: String,
to: String,
date: UnixTimestamp,
references: String,
in_reply_to: String,
}
// #[derive(Serialize)]
// struct Node {
// id: String,
// subject: String,
// from: String,
// to: String,
// date: UnixTimestamp,
// references: String,
// in_reply_to: String,
// }
#[derive(Serialize)]
struct Link {
source: String,
target: String,
}
// #[derive(Serialize)]
// struct Link {
// source: String,
// target: String,
// }
#[derive(Serialize)]
struct Graph {
nodes: Vec<Node>,
links: Vec<Link>,
}
// #[derive(Serialize)]
// struct Graph {
// nodes: Vec<Node>,
// links: Vec<Link>,
// }
/*
fn save_graph(