From 992b0f5e6068094b4f5c397fa3a695452f858490 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 27 Sep 2026 04:28:55 +0000 Subject: [PATCH] Fix if-let-guard compile error on stable Rust CalendarEvent and RelayStatus construction used if-let guards inside match arms, an unstable feature not available on stable rustc. Rewrite both as a nested match on the fallible conversions instead, with identical accept/reject behaviour. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01D95PWA2fdNfg7nUvUHBeMi --- crates/nscript-runtime/src/lib.rs | 36 ++++++++++++++++--------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/crates/nscript-runtime/src/lib.rs b/crates/nscript-runtime/src/lib.rs index 8021be4..7064e40 100644 --- a/crates/nscript-runtime/src/lib.rs +++ b/crates/nscript-runtime/src/lib.rs @@ -8949,15 +8949,16 @@ fn normalize_record(value: &OperationValue) -> OperationValue { integer("end"), text("location"), ) { - (Some(title), Some(start), Some(end), Some(location)) - if let (Ok(start), Ok(end)) = (u64::try_from(start), u64::try_from(end)) => - { - OperationValue::CalendarEvent(CalendarEvent { - title, - start, - end, - location, - }) + (Some(title), Some(start), Some(end), Some(location)) => { + match (u64::try_from(start), u64::try_from(end)) { + (Ok(start), Ok(end)) => OperationValue::CalendarEvent(CalendarEvent { + title, + start, + end, + location, + }), + _ => value.clone(), + } } _ => value.clone(), }, @@ -8966,14 +8967,15 @@ fn normalize_record(value: &OperationValue) -> OperationValue { integer("uptime_percent"), integer("latency_ms"), ) { - (Some(relay), Some(uptime_percent), Some(latency_ms)) - if let Ok(uptime_percent) = u8::try_from(uptime_percent) => - { - OperationValue::RelayStatus(RelayStatus { - relay, - uptime_percent, - latency_ms, - }) + (Some(relay), Some(uptime_percent), Some(latency_ms)) => { + match u8::try_from(uptime_percent) { + Ok(uptime_percent) => OperationValue::RelayStatus(RelayStatus { + relay, + uptime_percent, + latency_ms, + }), + _ => value.clone(), + } } _ => value.clone(), },