Merge pull request #27 from storytold/pr/never-crash-clean-crates

Never crash: deny the panicking lints in the already-clean crates and apps
This commit is contained in:
Brandon Thomas 2026-10-04 16:19:27 -04:00 committed by GitHub
commit 694e40546c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 33 additions and 3 deletions

View File

@ -289,20 +289,25 @@ impl ByteReader for BlobReader {
} }
return Err(filmcraft_media::pending::would_block()); return Err(filmcraft_media::pending::would_block());
} }
FS.with(|fs| { let complete = FS.with(|fs| {
let mut fs = fs.borrow_mut(); let mut fs = fs.borrow_mut();
fs.clock += 1; fs.clock += 1;
let t = fs.clock; let t = fs.clock;
let mut pos = 0usize; let mut pos = 0usize;
for c in c0..=c1 { for c in c0..=c1 {
let (d, used) = fs.chunks.get_mut(&(self.id, c)).expect("checked above"); // Present (checked above); evicted in between would be a bug, reported as an error.
let Some((d, used)) = fs.chunks.get_mut(&(self.id, c)) else { return false };
*used = t; *used = t;
let a = if c == c0 { (offset - c * CHUNK) as usize } else { 0 }; let a = if c == c0 { (offset - c * CHUNK) as usize } else { 0 };
let n = (d.len() - a).min(buf.len() - pos); let n = (d.len() - a).min(buf.len() - pos);
buf[pos..pos + n].copy_from_slice(&d[a..a + n]); buf[pos..pos + n].copy_from_slice(&d[a..a + n]);
pos += n; pos += n;
} }
true
}); });
if !complete {
return Err(filmcraft_media::pending::would_block());
}
// read-ahead for sequential access // read-ahead for sequential access
for c in c1 + 1..=(c1 + READ_AHEAD).min(last) { for c in c1 + 1..=(c1 + READ_AHEAD).min(last) {
request(self.id, c); request(self.id, c);

View File

@ -16,6 +16,7 @@
//! //!
//! Everything here is `wasm32`-only; on other targets the crate is empty. //! Everything here is `wasm32`-only; on other targets the crate is empty.
#![cfg(target_arch = "wasm32")] #![cfg(target_arch = "wasm32")]
#![cfg_attr(not(test), deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable))]
pub mod api; pub mod api;
pub mod audio; pub mod audio;

View File

@ -463,7 +463,7 @@ impl WcSource {
c.frames.insert(pts, Arc::new(f)); c.frames.insert(pts, Arc::new(f));
} }
while c.frames.len() > CACHE_FRAMES { while c.frames.len() > CACHE_FRAMES {
let far = c.frames.keys().copied().max_by_key(|p| (p - want).abs()).expect("non-empty"); let Some(far) = c.frames.keys().copied().max_by_key(|p| (p - want).abs()) else { break };
c.frames.remove(&far); c.frames.remove(&far);
} }
// the session's own frame came out: other requests may restart it now // the session's own frame came out: other requests may restart it now

View File

@ -15,6 +15,8 @@
//! asking, `--no-recover` starts without asking (the changes stay available via File ▸ Recover //! asking, `--no-recover` starts without asking (the changes stay available via File ▸ Recover
//! Unsaved Changes…). //! Unsaved Changes…).
#![cfg_attr(not(test), deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable))]
mod app_nap; mod app_nap;
mod audio; mod audio;
mod audio_in; mod audio_in;

View File

@ -31,6 +31,8 @@
//! # Ok::<(), filmcraft_aac::Error>(()) //! # Ok::<(), filmcraft_aac::Error>(())
//! ``` //! ```
#![cfg_attr(not(test), deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable))]
mod config; mod config;
mod decoder; mod decoder;
mod encoder; mod encoder;

View File

@ -5,6 +5,8 @@
//! - [`unescape_rbsp`] / [`escape_rbsp`]: remove/insert H.264/HEVC emulation-prevention bytes. //! - [`unescape_rbsp`] / [`escape_rbsp`]: remove/insert H.264/HEVC emulation-prevention bytes.
//! - [`annexb_nals`] / [`length_prefixed_nals`]: split Annex-B byte streams and AVCC/HVCC samples into NAL units. //! - [`annexb_nals`] / [`length_prefixed_nals`]: split Annex-B byte streams and AVCC/HVCC samples into NAL units.
#![cfg_attr(not(test), deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable))]
use std::fmt; use std::fmt;
#[derive(Debug, Clone, Copy, PartialEq, Eq)] #[derive(Debug, Clone, Copy, PartialEq, Eq)]

View File

@ -15,6 +15,8 @@
//! //!
//! Layer L0: no dependencies beyond `std`, no `unsafe`, builds for `wasm32-unknown-unknown`. //! Layer L0: no dependencies beyond `std`, no `unsafe`, builds for `wasm32-unknown-unknown`.
#![cfg_attr(not(test), deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable))]
mod read; mod read;
mod write; mod write;

View File

@ -5,6 +5,8 @@
//! The compositor works in **linear-light, premultiplied RGBA f32** in the sequence working space //! The compositor works in **linear-light, premultiplied RGBA f32** in the sequence working space
//! (Rec.709 primaries by default). Decoded frames carry [`ColorInfo`] so conversions are explicit. //! (Rec.709 primaries by default). Decoded frames carry [`ColorInfo`] so conversions are explicit.
#![cfg_attr(not(test), deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable))]
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::sync::OnceLock; use std::sync::OnceLock;

View File

@ -34,6 +34,8 @@
//! per-character text styles (`TrackItem::graphic`, `EffectInstance::layer`) and source graphics //! per-character text styles (`TrackItem::graphic`, `EffectInstance::layer`) and source graphics
//! (`Project::source_graphics`). No-op step; older builds would drop these fields when saving. //! (`Project::source_graphics`). No-op step; older builds would drop these fields when saving.
#![cfg_attr(not(test), deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable))]
pub mod atomic; pub mod atomic;
pub mod autosave; pub mod autosave;

View File

@ -5,6 +5,8 @@
//! compositor. Pixel data is `Arc`-shared so caches, monitors and export share frames for free. //! compositor. Pixel data is `Arc`-shared so caches, monitors and export share frames for free.
//! - [`AudioBuffer`]: planar f32 samples. //! - [`AudioBuffer`]: planar f32 samples.
#![cfg_attr(not(test), deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable))]
use std::sync::Arc; use std::sync::Arc;
use filmcraft_color::{ColorInfo, DecodeTable, Matrix, Range, linear_to_srgb_u8, normalize_c, normalize_y, srgb_u8_to_linear_table, to_linear, ycbcr_to_rgb}; use filmcraft_color::{ColorInfo, DecodeTable, Matrix, Range, linear_to_srgb_u8, normalize_c, normalize_y, srgb_u8_to_linear_table, to_linear, ycbcr_to_rgb};

View File

@ -1,5 +1,7 @@
//! 2D geometry for FilmCraft: vectors, rectangles and affine transforms (Motion effect math). //! 2D geometry for FilmCraft: vectors, rectangles and affine transforms (Motion effect math).
#![cfg_attr(not(test), deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable))]
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::ops::{Add, Mul, Sub}; use std::ops::{Add, Mul, Sub};

View File

@ -8,6 +8,8 @@
//! //!
//! See the crate README for supported boxes and limitations. //! See the crate README for supported boxes and limitations.
#![cfg_attr(not(test), deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable))]
mod bytes; mod bytes;
mod codec; mod codec;
mod demux; mod demux;

View File

@ -7,6 +7,8 @@
//! //!
//! Time passed to a source is **media time** (0 = first frame of the media), in ticks. //! Time passed to a source is **media time** (0 = first frame of the media), in ticks.
#![cfg_attr(not(test), deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable))]
pub mod cache; pub mod cache;
pub mod cancel; pub mod cancel;
pub mod digits; pub mod digits;

View File

@ -20,6 +20,8 @@
//! `[-0.1, 1.1]` without (values outside are dropped). With 256 rows over `[0, 1]`, an 8-bit code //! `[-0.1, 1.1]` without (values outside are dropped). With 256 rows over `[0, 1]`, an 8-bit code
//! value `c` lands exactly on row `c`. //! value `c` lands exactly on row `c`.
#![cfg_attr(not(test), deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable))]
pub mod paint; pub mod paint;
pub mod summary; pub mod summary;
#[cfg(test)] #[cfg(test)]

View File

@ -14,6 +14,8 @@
//! //!
//! See `docs/transcripts.md` for the user-facing behaviour and accuracy numbers. //! See `docs/transcripts.md` for the user-facing behaviour and accuracy numbers.
#![cfg_attr(not(test), deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable))]
pub mod diarize; pub mod diarize;
pub mod mel; pub mod mel;
pub mod models; pub mod models;