mirror of
https://github.com/storytold/effectcraft.git
synced 2026-11-10 18:31:30 -06:00
Never crash: raster and path crates without expect()/unwrap()/unreachable!()
raster: the inpainting pyramid stops at a missing level, and video inpainting falls back to a plain patch fill if the previous frame is missing, instead of expect(). path: curve fitting of an empty point list returns a degenerate cubic instead of indexing/unwrapping, and Merge Paths no longer has an unreachable!() arm. Denies the panic lints in both crates. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
10644a83aa
commit
786e4e8b97
@@ -497,7 +497,7 @@ pub fn patch_fill(img: &Image, hole: &[bool], init: Option<&Image>, patch: usize
|
||||
// Pyramid: stop while the image is still a few patches across.
|
||||
let mut levels = vec![fine];
|
||||
while levels.len() < 6 {
|
||||
let last = levels.last().expect("level");
|
||||
let Some(last) = levels.last() else { break };
|
||||
if last.w.min(last.h) / 2 < patch * 4 || !last.hole.iter().any(|b| *b) {
|
||||
break;
|
||||
}
|
||||
@@ -774,7 +774,11 @@ pub fn fill_sequence(input: &FillInput, o: &FillOpts, progress: &mut dyn FnMut(u
|
||||
out[t] = Some(img.clone());
|
||||
} else {
|
||||
// Warp the previous result here along the backward flow (t → t − 1).
|
||||
let prev = out[t - 1].as_ref().expect("previous frame");
|
||||
// Frames after `t0` are filled in order, so the previous one is set.
|
||||
let Some(prev) = out[t - 1].as_ref() else {
|
||||
out[t] = Some(patch_fill(img, left, None, o.patch, o.seed));
|
||||
continue;
|
||||
};
|
||||
let mut warped = img.clone();
|
||||
for i in 0..w * h {
|
||||
if left[i] {
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
//! [`Image`] stores premultiplied RGBA in `f32` (values may exceed 1.0 in 32 bpc projects). Every
|
||||
//! heavy operation is row-parallel with rayon.
|
||||
|
||||
#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]
|
||||
|
||||
pub mod blur;
|
||||
pub mod channels3d;
|
||||
pub mod cuts;
|
||||
|
||||
Reference in New Issue
Block a user