mirror of
https://github.com/chatmail/core.git
synced 2026-05-17 05:46:30 +03:00
chore: apply beta clippy fixes
This commit is contained in:
@@ -93,7 +93,7 @@ impl<'a> BlobObject<'a> {
|
|||||||
if let Some(extension) = original_name.extension().filter(|e| e.len() <= 32) {
|
if let Some(extension) = original_name.extension().filter(|e| e.len() <= 32) {
|
||||||
let extension = extension.to_string_lossy().to_lowercase();
|
let extension = extension.to_string_lossy().to_lowercase();
|
||||||
let extension = sanitize_filename(&extension);
|
let extension = sanitize_filename(&extension);
|
||||||
format!("$BLOBDIR/{hash}.{}", extension)
|
format!("$BLOBDIR/{hash}.{extension}")
|
||||||
} else {
|
} else {
|
||||||
format!("$BLOBDIR/{hash}")
|
format!("$BLOBDIR/{hash}")
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -653,7 +653,7 @@ impl ChatId {
|
|||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let chat_id = ChatId::create_for_contact_with_blocked(context, contact_id, Blocked::Yes)
|
let chat_id = ChatId::create_for_contact_with_blocked(context, contact_id, Blocked::Yes)
|
||||||
.await
|
.await
|
||||||
.with_context(|| format!("can't create chat for {}", contact_id))?;
|
.with_context(|| format!("can't create chat for {contact_id}"))?;
|
||||||
chat_id
|
chat_id
|
||||||
.set_protection(
|
.set_protection(
|
||||||
context,
|
context,
|
||||||
|
|||||||
@@ -322,7 +322,7 @@ impl Chatlist {
|
|||||||
(chat_id, MessageState::OutDraft),
|
(chat_id, MessageState::OutDraft),
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
.with_context(|| format!("failed to get msg ID for chat {}", chat_id))?;
|
.with_context(|| format!("failed to get msg ID for chat {chat_id}"))?;
|
||||||
ids.push((chat_id, msg_id));
|
ids.push((chat_id, msg_id));
|
||||||
}
|
}
|
||||||
Ok(Chatlist { ids })
|
Ok(Chatlist { ids })
|
||||||
|
|||||||
@@ -1061,21 +1061,21 @@ impl Context {
|
|||||||
)
|
)
|
||||||
.await?
|
.await?
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
res += &format!("num_msgs {}\n", num_msgs);
|
res += &format!("num_msgs {num_msgs}\n");
|
||||||
|
|
||||||
let num_chats: u32 = self
|
let num_chats: u32 = self
|
||||||
.sql
|
.sql
|
||||||
.query_get_value("SELECT COUNT(*) FROM chats WHERE id>9 AND blocked!=1", ())
|
.query_get_value("SELECT COUNT(*) FROM chats WHERE id>9 AND blocked!=1", ())
|
||||||
.await?
|
.await?
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
res += &format!("num_chats {}\n", num_chats);
|
res += &format!("num_chats {num_chats}\n");
|
||||||
|
|
||||||
let db_size = tokio::fs::metadata(&self.sql.dbfile).await?.len();
|
let db_size = tokio::fs::metadata(&self.sql.dbfile).await?.len();
|
||||||
res += &format!("db_size_bytes {}\n", db_size);
|
res += &format!("db_size_bytes {db_size}\n");
|
||||||
|
|
||||||
let secret_key = &load_self_secret_key(self).await?.primary_key;
|
let secret_key = &load_self_secret_key(self).await?.primary_key;
|
||||||
let key_created = secret_key.created_at().timestamp();
|
let key_created = secret_key.created_at().timestamp();
|
||||||
res += &format!("key_created {}\n", key_created);
|
res += &format!("key_created {key_created}\n");
|
||||||
|
|
||||||
// how many of the chats active in the last months are:
|
// how many of the chats active in the last months are:
|
||||||
// - protected
|
// - protected
|
||||||
@@ -1155,7 +1155,7 @@ impl Context {
|
|||||||
id
|
id
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
res += &format!("self_reporting_id {}", self_reporting_id);
|
res += &format!("self_reporting_id {self_reporting_id}");
|
||||||
|
|
||||||
Ok(res)
|
Ok(res)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,8 +56,7 @@ fn test_build_sequence_sets() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let has_number = |(uids, s): &(Vec<u32>, String), number| {
|
let has_number = |(uids, s): &(Vec<u32>, String), number| {
|
||||||
uids.iter().any(|&n| n == number)
|
uids.contains(&number) && s.split(',').any(|n| n.parse::<u32>().unwrap() == number)
|
||||||
&& s.split(',').any(|n| n.parse::<u32>().unwrap() == number)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let numbers: Vec<_> = (2..=500).step_by(2).collect();
|
let numbers: Vec<_> = (2..=500).step_by(2).collect();
|
||||||
|
|||||||
@@ -2380,7 +2380,7 @@ async fn handle_ndn(
|
|||||||
let aggregated_error = message
|
let aggregated_error = message
|
||||||
.error
|
.error
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map(|err| format!("{}\n\n{}", err, err_msg));
|
.map(|err| format!("{err}\n\n{err_msg}"));
|
||||||
set_msg_failed(
|
set_msg_failed(
|
||||||
context,
|
context,
|
||||||
&mut message,
|
&mut message,
|
||||||
|
|||||||
@@ -904,7 +904,7 @@ async fn test_concat_multiple_ndns() -> Result<()> {
|
|||||||
let raw = include_str!("../../test-data/message/posteo_ndn.eml");
|
let raw = include_str!("../../test-data/message/posteo_ndn.eml");
|
||||||
let raw = raw.replace(
|
let raw = raw.replace(
|
||||||
"Message-ID: <04422840-f884-3e37-5778-8192fe22d8e1@posteo.de>",
|
"Message-ID: <04422840-f884-3e37-5778-8192fe22d8e1@posteo.de>",
|
||||||
&format!("Message-ID: <{}>", mid),
|
&format!("Message-ID: <{mid}>"),
|
||||||
);
|
);
|
||||||
receive_imf(&t, raw.as_bytes(), false).await?;
|
receive_imf(&t, raw.as_bytes(), false).await?;
|
||||||
|
|
||||||
|
|||||||
@@ -965,7 +965,7 @@ impl Message {
|
|||||||
let fingerprint = load_self_public_key(context).await?.dc_fingerprint().hex();
|
let fingerprint = load_self_public_key(context).await?.dc_fingerprint().hex();
|
||||||
let data = format!("{}-{}", fingerprint, self.rfc724_mid);
|
let data = format!("{}-{}", fingerprint, self.rfc724_mid);
|
||||||
let hash = Sha256::digest(data.as_bytes());
|
let hash = Sha256::digest(data.as_bytes());
|
||||||
Ok(format!("{:x}", hash))
|
Ok(format!("{hash:x}"))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get link attached to an info message.
|
/// Get link attached to an info message.
|
||||||
|
|||||||
Reference in New Issue
Block a user