style(agent): use match as expression for parsed_thread_uuid

Refactor mutable variable + match arm assignment into idiomatic
Rust match-as-expression pattern. Also remove unused uuid::Uuid
import that was left behind after the parse-once optimization.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
This commit is contained in:
Zaki
2026-03-22 18:28:09 -07:00
co-authored by Claude Opus 4.6
parent 9cff809950
commit 09e59c7c28
+5 -7
View File
@@ -10,7 +10,6 @@
use std::sync::Arc;
use futures::StreamExt;
use uuid::Uuid;
use crate::agent::context_monitor::ContextMonitor;
use crate::agent::heartbeat::spawn_heartbeat;
@@ -1005,22 +1004,21 @@ impl Agent {
// Hydrate thread from DB if it's a historical thread not in memory.
// Capture the parsed UUID to avoid redundant re-parsing downstream.
let mut parsed_thread_uuid: Option<Uuid> = None;
if let Some(external_thread_id) = message.conversation_scope() {
let parsed_thread_uuid = if let Some(external_thread_id) = message.conversation_scope() {
tracing::trace!(
message_id = %message.id,
thread_id = %external_thread_id,
"Hydrating thread from DB"
);
match self.maybe_hydrate_thread(message, external_thread_id).await {
Ok(uuid) => {
parsed_thread_uuid = uuid;
}
Ok(uuid) => uuid,
Err(rejection) => {
return Ok(Some(format!("Error: {}", rejection)));
}
}
}
} else {
None
};
// Resolve session and thread. Approval submissions are allowed to
// target an already-loaded owned thread by UUID across channels so the