Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
style: use saturating_sub for Duration subtraction
Richie McIlroy8fb751dc40e4
diff --git a/crates/recording/src/output_pipeline/core.rs b/crates/recording/src/output_pipeline/core.rsindex d287a30f1..d6cd9a6ff 100644--- a/crates/recording/src/output_pipeline/core.rs+++ b/crates/recording/src/output_pipeline/core.rs@@ -5601,15 +5601,15 @@ mod tests {if secs < 1.9 {assert_eq!(deferred[index], previous[index], "frame {index}");} else if (2.1..2.9).contains(&secs) {- let step = deferred[index] - deferred[index - 1];+ let step = deferred[index].saturating_sub(deferred[index - 1]);assert!(step.as_nanos().abs_diff(u128::from(frame_ns)) < 1_000,"frame {index}: {step:?}");} else if secs > 3.2 {assert_eq!(- deferred[index] - deferred[index - 1],- previous[index] - previous[index - 1],+ deferred[index].saturating_sub(deferred[index - 1]),+ previous[index].saturating_sub(previous[index - 1]),"frame {index}");}