Skip to content

EffectCraft: An open-source motion graphics and compositing tool written by scratch in pure Rust

Never crash: deny panic lints in the already-clean crates and apps

Brandon Thomasc5e33f1a0230
diff --git a/apps/effectcraft-cli/src/main.rs b/apps/effectcraft-cli/src/main.rs
index aa6c73843..753f0626c 100644
--- a/apps/effectcraft-cli/src/main.rs
+++ b/apps/effectcraft-cli/src/main.rs
@@ -34,6 +34,8 @@
//! `<comp>` is a comp id or name (`-` = the active comp); `<layer>` an id, `#n` or name; `<value>`
//! is JSON (`50`, `[960,540]`, `"#ff0000"`) or a bare string. See `docs/agents.md`.
+#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]
+
use effectcraft_automation::tools::{self, Reply};
use effectcraft_automation::{Backend, McpServer};
use serde_json::{Value, json};
diff --git a/apps/effectcraft-web/src/lib.rs b/apps/effectcraft-web/src/lib.rs
index 013e0d36d..0d59906f2 100644
--- a/apps/effectcraft-web/src/lib.rs
+++ b/apps/effectcraft-web/src/lib.rs
@@ -20,6 +20,8 @@
//!
//! [`store`] is portable (unit-tested natively); everything else is `wasm32`-only.
+#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]
+
pub mod store;
#[cfg(target_arch = "wasm32")]
diff --git a/apps/effectcraft/src/main.rs b/apps/effectcraft/src/main.rs
index 2262ad80e..d365d01d1 100644
--- a/apps/effectcraft/src/main.rs
+++ b/apps/effectcraft/src/main.rs
@@ -5,6 +5,8 @@
//! `--control <port>` (or `EFFECTCRAFT_CONTROL_PORT`) starts a localhost JSON-lines control server;
//! see `effectcraft_ui_egui::control` for the methods.
+#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]
+
mod audio_out;
mod control_server;
#[cfg(target_os = "macos")]
diff --git a/clippy.toml b/clippy.toml
new file mode 100644
index 000000000..4b6c79f55
--- /dev/null
+++ b/clippy.toml
@@ -0,0 +1,4 @@
+allow-unwrap-in-tests = true
+allow-expect-in-tests = true
+allow-panic-in-tests = true
+allow-indexing-slicing-in-tests = true
diff --git a/crates/automation/src/lib.rs b/crates/automation/src/lib.rs
index e3bf88cd1..fc3767b10 100644
--- a/crates/automation/src/lib.rs
+++ b/crates/automation/src/lib.rs
@@ -13,6 +13,8 @@
//! Layering: depends on `effectcraft-engine` only (never egui); the CLI injects a fully wired
//! session (`effectcraft_host::session()`).
+#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]
+
pub mod backend;
pub mod base64;
pub mod bridge;
diff --git a/crates/color/src/lib.rs b/crates/color/src/lib.rs
index fd94e5a83..1fae0ea90 100644
--- a/crates/color/src/lib.rs
+++ b/crates/color/src/lib.rs
@@ -5,6 +5,8 @@
//! standard definitions of the "classic" photographic modes; they are applied to un-premultiplied
//! colour and composited with Porter-Duff source-over on premultiplied pixels.
+#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]
+
pub mod blend;
pub mod icc;
pub mod space;
diff --git a/crates/export/src/lib.rs b/crates/export/src/lib.rs
index 84cf40c34..77b48450a 100644
--- a/crates/export/src/lib.rs
+++ b/crates/export/src/lib.rs
@@ -28,6 +28,8 @@
//! H.264 requires even dimensions: odd output sizes are cropped by one pixel (padded when the
//! output is a single pixel wide/high).
+#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]
+
mod encode;
mod hevc_av1;
mod out;
diff --git a/crates/geom/src/lib.rs b/crates/geom/src/lib.rs
index fda0ac01d..a03c9d46c 100644
--- a/crates/geom/src/lib.rs
+++ b/crates/geom/src/lib.rs
@@ -5,6 +5,8 @@
//! clockwise on screen, 3D uses a left-handed system with +z pointing into the screen, and a 3D
//! layer's rotation is Orientation (X, Y, Z) followed by X Rotation, Y Rotation, Z Rotation.
+#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]
+
use std::ops::{Add, AddAssign, Div, Mul, MulAssign, Neg, Sub, SubAssign};
use serde::{Deserialize, Serialize};
diff --git a/crates/host/src/lib.rs b/crates/host/src/lib.rs
index 80d902e92..be26b169a 100644
--- a/crates/host/src/lib.rs
+++ b/crates/host/src/lib.rs
@@ -3,6 +3,8 @@
//! Render Queue export through `effectcraft-export` (FilmCraft's encoders). Frontends (desktop,
//! CLI, MCP, web) start here.
+#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]
+
use std::sync::Arc;
use effectcraft_engine::project::render_queue::OutputFormat;
diff --git a/crates/model/src/lib.rs b/crates/model/src/lib.rs
index 93a6a9f98..144f4e8ea 100644
--- a/crates/model/src/lib.rs
+++ b/crates/model/src/lib.rs
@@ -12,6 +12,8 @@
//! Models are in their own units with +Y up (glTF's convention); the renderer maps them into
//! After Effects' Y-down pixel space.
+#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]
+
pub mod extrude;
pub mod gltf;
pub mod obj;
diff --git a/crates/plugin/src/lib.rs b/crates/plugin/src/lib.rs
index 1231d171b..829964378 100644
--- a/crates/plugin/src/lib.rs
+++ b/crates/plugin/src/lib.rs
@@ -22,6 +22,8 @@
//! differently on another machine. The runtime is the `wasm` feature (on for the desktop app and
//! the CLI); without it [`load_wasm`] says plug-ins are unavailable.
+#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]
+
use effectcraft_effects::EffectSpec;
pub use effectcraft_effects::plugin::{EffectPlugin, PLUGIN_API_VERSION, PluginFrame, PluginManifest, PluginParams, register_plugin};
@@ -62,5 +64,7 @@ pub fn loader(bytes: &[u8], source: &str) -> Result<serde_json::Value, String> {
}))
}
-#[cfg(all(test, feature = "wasm"))]
+// Two attributes, so clippy sees `cfg(test)` and treats the module as test code.
+#[cfg(test)]
+#[cfg(feature = "wasm")]
mod tests;