From 3bd64b74a4160654c1daac48da60ca1c861b37bf Mon Sep 17 00:00:00 2001 From: Andrey P Date: Mon, 26 Jan 2026 09:26:43 +0000 Subject: [PATCH] Fix: E0716 temporary value dropped while borrowed Updated the AlertData::Custom formatting logic to resolve a compiler error introduced in newer Rust versions (1.92+). The previous use of format_args! within an if/else block created temporary values that were dropped before they could be used by the outer format! macro. --- bin/core/src/alert/discord.rs | 15 +++++++-------- bin/core/src/alert/mod.rs | 15 +++++++-------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/bin/core/src/alert/discord.rs b/bin/core/src/alert/discord.rs index 427227d48..6d1967802 100644 --- a/bin/core/src/alert/discord.rs +++ b/bin/core/src/alert/discord.rs @@ -230,14 +230,13 @@ pub async fn send_alert( ) } AlertData::Custom { message, details } => { - format!( - "{level} | {message}{}", - if details.is_empty() { - format_args!("") - } else { - format_args!("\n{details}") - } - ) + let details_str = if details.is_empty() { + String::new() + } else { + format!("\n{details}") + }; + + format!("{level} | {message}{details_str}") } AlertData::None {} => Default::default(), }; diff --git a/bin/core/src/alert/mod.rs b/bin/core/src/alert/mod.rs index 9eba5dab7..1f51ac201 100644 --- a/bin/core/src/alert/mod.rs +++ b/bin/core/src/alert/mod.rs @@ -474,14 +474,13 @@ fn standard_alert_content(alert: &Alert) -> String { ) } AlertData::Custom { message, details } => { - format!( - "{level} | {message}{}", - if details.is_empty() { - format_args!("") - } else { - format_args!("\n{details}") - } - ) + let details_str = if details.is_empty() { + String::new() + } else { + format!("\n{details}") + }; + + format!("{level} | {message}{details_str}") } AlertData::None {} => Default::default(), }