From d856614d2e65fd9da67dd80e425382a50952f3fc Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Sun, 8 Mar 2026 22:03:39 -0700 Subject: [PATCH] Document why SandboxExecConfig::to_json cannot fail MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The struct contains only Strings, Vec, and bool — no cycles or non-serializable types — so the expect is justified. --- crates/terminal/src/sandbox_exec.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/terminal/src/sandbox_exec.rs b/crates/terminal/src/sandbox_exec.rs index ba9b94cf6bb2833bd0be8e327418deda44a7866b..dac19381f4361663e9e3d69f3cf0e18b371e83a2 100644 --- a/crates/terminal/src/sandbox_exec.rs +++ b/crates/terminal/src/sandbox_exec.rs @@ -112,7 +112,9 @@ impl SandboxExecConfig { /// Serialize the config to a JSON string for passing via CLI arg. pub fn to_json(&self) -> String { - serde_json::to_string(self).expect("failed to serialize sandbox config") + // This type is a flat struct of Strings, Vec, and bool — no + // cycles or non-serializable types — so serialization cannot fail. + serde_json::to_string(self).expect("SandboxExecConfig is non-cyclic") } /// Deserialize a config from a JSON string.