Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix: address clippy warnings - collapsible if and abs_diff

Cursor Agentab623ee5932a
diff --git a/crates/editor/src/playback.rs b/crates/editor/src/playback.rs
index 4f64aeef8..dbedf9f8f 100644
--- a/crates/editor/src/playback.rs
+++ b/crates/editor/src/playback.rs
@@ -106,12 +106,7 @@ impl FrameCache {
.cache
.iter()
.filter_map(|(k, _)| {
- let distance = if *k > current_frame {
- *k - current_frame
- } else {
- current_frame - *k
- };
- if distance > max_distance {
+ if (*k).abs_diff(current_frame) > max_distance {
Some(*k)
} else {
None
diff --git a/crates/rendering/src/lib.rs b/crates/rendering/src/lib.rs
index dbcf768c0..1bd37aa80 100644
--- a/crates/rendering/src/lib.rs
+++ b/crates/rendering/src/lib.rs
@@ -532,12 +532,13 @@ pub async fn render_video_to_channel(
sender.send((frame, current_frame_number)).await?;
}
- if let Some(Ok(final_frame)) = frame_renderer.flush_pipeline().await {
- if final_frame.width > 0 && final_frame.height > 0 {
- sender
- .send((final_frame, frame_number.saturating_sub(1)))
- .await?;
- }
+ if let Some(Ok(final_frame)) = frame_renderer.flush_pipeline().await
+ && final_frame.width > 0
+ && final_frame.height > 0
+ {
+ sender
+ .send((final_frame, frame_number.saturating_sub(1)))
+ .await?;
}
let total_time = start_time.elapsed();