mirror of
https://github.com/chatmail/core.git
synced 2026-04-20 15:06:30 +03:00
Inline format arguments
This feature has been stable since Rust 1.58.0.
This commit is contained in:
@@ -377,13 +377,13 @@ impl MimeMessage {
|
||||
}
|
||||
Err(err) => {
|
||||
let msg_body = stock_str::cant_decrypt_msg_body(context).await;
|
||||
let txt = format!("[{}]", msg_body);
|
||||
let txt = format!("[{msg_body}]");
|
||||
|
||||
let part = Part {
|
||||
typ: Viewtype::Text,
|
||||
msg_raw: Some(txt.clone()),
|
||||
msg: txt,
|
||||
error: Some(format!("Decrypting failed: {:#}", err)),
|
||||
error: Some(format!("Decrypting failed: {err:#}")),
|
||||
..Default::default()
|
||||
};
|
||||
parser.parts.push(part);
|
||||
@@ -669,14 +669,14 @@ impl MimeMessage {
|
||||
if let Ok(decoded_data) = avatar {
|
||||
let extension = if let Ok(format) = image::guess_format(&decoded_data) {
|
||||
if let Some(ext) = format.extensions_str().first() {
|
||||
format!(".{}", ext)
|
||||
format!(".{ext}")
|
||||
} else {
|
||||
String::new()
|
||||
}
|
||||
} else {
|
||||
String::new()
|
||||
};
|
||||
match BlobObject::create(context, &format!("avatar{}", extension), &decoded_data)
|
||||
match BlobObject::create(context, &format!("avatar{extension}"), &decoded_data)
|
||||
.await
|
||||
{
|
||||
Ok(blob) => Some(AvatarAction::Change(blob.as_name().to_string())),
|
||||
@@ -1302,7 +1302,7 @@ impl MimeMessage {
|
||||
self.is_system_message = SystemMessage::Unknown;
|
||||
if let Some(part) = self.parts.first_mut() {
|
||||
part.typ = Viewtype::Text;
|
||||
part.msg = format!("[{}]", error_msg);
|
||||
part.msg = format!("[{error_msg}]");
|
||||
self.parts.truncate(1);
|
||||
}
|
||||
}
|
||||
@@ -1882,7 +1882,7 @@ fn get_attachment_filename(
|
||||
// If there is no filename, but part is an attachment, guess filename
|
||||
if desired_filename.is_none() && ct.disposition == DispositionType::Attachment {
|
||||
if let Some(subtype) = mail.ctype.mimetype.split('/').nth(1) {
|
||||
desired_filename = Some(format!("file.{}", subtype,));
|
||||
desired_filename = Some(format!("file.{subtype}",));
|
||||
} else {
|
||||
bail!(
|
||||
"could not determine attachment filename: {:?}",
|
||||
|
||||
Reference in New Issue
Block a user