From 708e6b23b212e9908eae777164b5fd5a35983803 Mon Sep 17 00:00:00 2001 From: 2witstudios <2witstudios@gmail.com> Date: Sat, 7 Mar 2026 21:55:11 -0600 Subject: [PATCH 1/2] fix: Replace bare unwrap() with expect() for clarity Aligns id.rs random_id() with the expect() pattern already used by root_agent_name() and worktree_agent_name() in the same file. Adds descriptive expect messages to template.rs file_name() calls. Co-Authored-By: Claude Opus 4.6 --- crates/pu-core/src/id.rs | 2 +- crates/pu-core/src/template.rs | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/crates/pu-core/src/id.rs b/crates/pu-core/src/id.rs index e4a9b1d..8da205d 100644 --- a/crates/pu-core/src/id.rs +++ b/crates/pu-core/src/id.rs @@ -8,7 +8,7 @@ const ID_LEN: usize = 8; fn random_id(prefix: &str) -> String { let mut rng = rand::rng(); let suffix: String = (0..ID_LEN) - .map(|_| *ALPHABET.choose(&mut rng).unwrap() as char) + .map(|_| *ALPHABET.choose(&mut rng).expect("ALPHABET is non-empty") as char) .collect(); format!("{prefix}{suffix}") } diff --git a/crates/pu-core/src/template.rs b/crates/pu-core/src/template.rs index 582de67..c5865db 100644 --- a/crates/pu-core/src/template.rs +++ b/crates/pu-core/src/template.rs @@ -230,7 +230,11 @@ fn scan_dir(dir: &Path, source: &str) -> Vec