refactor: Use variables directly in formatted strings (#7284)

made with `cargo clippy --all --fix` then manually reviewed to ensure
this was the only thing that changed.
This commit is contained in:
Simon Laux
2025-10-09 17:26:59 +02:00
committed by GitHub
parent 00ae7ce33c
commit af58b86b60
23 changed files with 55 additions and 76 deletions

View File

@@ -373,7 +373,7 @@ impl ChatId {
/// Returns true if the value was modified.
pub(crate) async fn set_blocked(self, context: &Context, new_blocked: Blocked) -> Result<bool> {
if self.is_special() {
bail!("ignoring setting of Block-status for {}", self);
bail!("ignoring setting of Block-status for {self}");
}
let count = context
.sql
@@ -702,8 +702,7 @@ impl ChatId {
) -> Result<()> {
ensure!(
!self.is_special(),
"bad chat_id, can not be special chat: {}",
self
"bad chat_id, can not be special chat: {self}"
);
context
@@ -813,8 +812,7 @@ impl ChatId {
pub(crate) async fn delete_ex(self, context: &Context, sync: sync::Sync) -> Result<()> {
ensure!(
!self.is_special(),
"bad chat_id, can not be a special chat: {}",
self
"bad chat_id, can not be a special chat: {self}"
);
let chat = Chat::load_from_db(context, self).await?;
@@ -3145,8 +3143,7 @@ pub async fn send_text_msg(
) -> Result<MsgId> {
ensure!(
!chat_id.is_special(),
"bad chat_id, can not be a special chat: {}",
chat_id
"bad chat_id, can not be a special chat: {chat_id}"
);
let mut msg = Message::new_text(text_to_send);
@@ -3914,13 +3911,11 @@ pub(crate) async fn add_contact_to_chat_ex(
let mut chat = Chat::load_from_db(context, chat_id).await?;
ensure!(
chat.typ == Chattype::Group || chat.typ == Chattype::OutBroadcast,
"{} is not a group/broadcast where one can add members",
chat_id
"{chat_id} is not a group/broadcast where one can add members"
);
ensure!(
Contact::real_exists_by_id(context, contact_id).await? || contact_id == ContactId::SELF,
"invalid contact_id {} for adding to group",
contact_id
"invalid contact_id {contact_id} for adding to group"
);
ensure!(!chat.is_mailing_list(), "Mailing lists can't be changed");
ensure!(
@@ -4133,8 +4128,7 @@ pub async fn remove_contact_from_chat(
) -> Result<()> {
ensure!(
!chat_id.is_special(),
"bad chat_id, can not be special chat: {}",
chat_id
"bad chat_id, can not be special chat: {chat_id}"
);
ensure!(
!contact_id.is_special() || contact_id == ContactId::SELF,
@@ -4148,7 +4142,7 @@ pub async fn remove_contact_from_chat(
"Cannot remove contact {contact_id} from chat {chat_id}: self not in group."
);
context.emit_event(EventType::ErrorSelfNotInGroup(err_msg.clone()));
bail!("{}", err_msg);
bail!("{err_msg}");
} else {
let mut sync = Nosync;
@@ -4390,7 +4384,7 @@ pub async fn forward_msgs(context: &Context, msg_ids: &[MsgId], chat_id: ChatId)
.await?;
let mut chat = Chat::load_from_db(context, chat_id).await?;
if let Some(reason) = chat.why_cant_send(context).await? {
bail!("cannot send to {}: {}", chat_id, reason);
bail!("cannot send to {chat_id}: {reason}");
}
curr_timestamp = create_smeared_timestamps(context, msg_ids.len());
let mut msgs = Vec::with_capacity(msg_ids.len());