mirror of
https://github.com/storytold/lightcraft.git
synced 2026-11-12 00:42:44 -06:00
Never crash: engine panic sites outside export.rs; mcp denies panics
- merge output_path: a bounded search for a free name instead of `for k in 1..` + unreachable!(). - library open: Option::insert returns the new library, no expect. - relink: a one-op batch unwraps through <[Op; 1]>::try_from, no expect. - lightcraft-mcp (already clean) now #![deny] unwrap/expect/panic/ unimplemented/todo/unreachable; clippy.toml as in the steering PR. crates/engine/src/export.rs keeps one expect (open PR #51 edits that file), so lightcraft-engine doesn't get the deny attribute yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
fb8e1e93aa
commit
a74b1b32ff
@@ -50,7 +50,11 @@ fn relink(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
{
|
||||
ops.extend(crate::cmd::convert::content_op(id, ph, info));
|
||||
}
|
||||
s.commit("Relink Photo", if ops.len() == 1 { ops.pop().expect("one op") } else { Op::Batch { ops } })?;
|
||||
let op = match <[Op; 1]>::try_from(ops) {
|
||||
Ok([op]) => op,
|
||||
Err(ops) => Op::Batch { ops },
|
||||
};
|
||||
s.commit("Relink Photo", op)?;
|
||||
s.media.forget(id);
|
||||
Ok(json!({"id": id.0, "path": abs}))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user