Never crash: engine without expect() (job polling, commands, menus)

Removes the engine's production expect() calls: background-job polling (camera, mask, roto,
point and warp tracking, render queue) uses let-else / if-let instead of take().expect("job"),
command helpers bind what they checked instead of re-reading it with expect, the menu bar falls
back to an empty tree (logged) instead of expect()ing that a constant parses, and
autotrace/text animator group lookups no longer expect a just-inserted group. perf.rs, the
benchmark harness behind `effectcraft-cli bench --ops`, opts out with a module-level allow.
Test-only unreachable!() calls become panic!() (clippy.toml allows panics in tests). Denies the
panic lints in the crate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Brandon Thomas
2026-10-04 13:40:46 -04:00
co-authored by Claude Opus 5.5
parent 10644a83aa
commit 3d5432c318
18 changed files with 57 additions and 48 deletions
+7 -1
View File
@@ -196,7 +196,13 @@ pub fn top_level() -> Vec<&'static str> {
/// The menu bar for this platform.
pub fn menu_bar() -> &'static [MenuNode] {
static BAR: OnceLock<Vec<MenuNode>> = OnceLock::new();
BAR.get_or_init(|| parse(TREE, cfg!(target_os = "macos")).expect("menu tree parses"))
BAR.get_or_init(|| {
// The tree is a constant (a test parses it on every platform); never panic over it.
parse(TREE, cfg!(target_os = "macos")).unwrap_or_else(|e| {
log::error!("menu tree: {e}");
Vec::new()
})
})
}
/// Every entry with its submenu path (`["Layer", "Blending Mode"]`), depth first.