From 76367e888ac60e53603f38a4dbefb296513e82e3 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 9 Oct 2026 16:01:14 +0200 Subject: [PATCH] mind-body: need() as a fn so the borrowed value outlives the closure Co-Authored-By: Claude Opus 5.5 --- crates/mind-body/src/cli.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/mind-body/src/cli.rs b/crates/mind-body/src/cli.rs index 5c4e013..e9b543e 100644 --- a/crates/mind-body/src/cli.rs +++ b/crates/mind-body/src/cli.rs @@ -70,7 +70,6 @@ fn parse_dial(flags: &[&str], now: DateTime, set_by: &str) -> Result, name: &str| value.ok_or_else(|| anyhow!("{name} is required")); Ok(BurnRate { heat: Decimal::from_str(need(heat, "--heat")?).context("--heat is not a decimal")?, base_cooldown_s: need(cooldown, "--base-cooldown-s")? @@ -82,6 +81,10 @@ fn parse_dial(flags: &[&str], now: DateTime, set_by: &str) -> Result(value: Option<&'a str>, name: &str) -> Result<&'a str> { + value.ok_or_else(|| anyhow!("{name} is required")) +} + fn show(path: &Path, instance: &Slug, out: &mut impl Write) -> Result<()> { let source = FileSource::new(path); writeln!(out, "instance: {}", instance.0)?;