Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

clippy

Richie McIlroy9285e02c11c4
diff --git a/crates/recording/src/output_pipeline/macos_fragmented_m4s.rs b/crates/recording/src/output_pipeline/macos_fragmented_m4s.rs
index 6d7c7532c..ad57659db 100644
--- a/crates/recording/src/output_pipeline/macos_fragmented_m4s.rs
+++ b/crates/recording/src/output_pipeline/macos_fragmented_m4s.rs
@@ -203,10 +203,10 @@ impl Muxer for MacOSFragmentedM4SMuxer {
}
}
- if let Ok(mut encoder) = state.encoder.lock() {
- if let Err(e) = encoder.finish_with_timestamp(timestamp) {
- warn!("Failed to finish segmented encoder: {e}");
- }
+ if let Ok(mut encoder) = state.encoder.lock()
+ && let Err(e) = encoder.finish_with_timestamp(timestamp)
+ {
+ warn!("Failed to finish segmented encoder: {e}");
}
}
@@ -269,7 +269,7 @@ impl MacOSFragmentedM4SMuxer {
if convert_elapsed_ms > SLOW_THRESHOLD_MS {
slow_convert_count += 1;
- if slow_convert_count <= 5 || slow_convert_count % 100 == 0 {
+ if slow_convert_count <= 5 || slow_convert_count.is_multiple_of(100) {
debug!(
elapsed_ms = convert_elapsed_ms,
count = slow_convert_count,
@@ -284,17 +284,17 @@ impl MacOSFragmentedM4SMuxer {
let encode_start = std::time::Instant::now();
let owned_frame = frame_pool.take_frame();
- if let Ok(mut encoder) = encoder_clone.lock() {
- if let Err(e) = encoder.queue_frame(owned_frame, timestamp) {
- warn!("Failed to encode frame: {e}");
- }
+ if let Ok(mut encoder) = encoder_clone.lock()
+ && let Err(e) = encoder.queue_frame(owned_frame, timestamp)
+ {
+ warn!("Failed to encode frame: {e}");
}
let encode_elapsed_ms = encode_start.elapsed().as_millis();
if encode_elapsed_ms > SLOW_THRESHOLD_MS {
slow_encode_count += 1;
- if slow_encode_count <= 5 || slow_encode_count % 100 == 0 {
+ if slow_encode_count <= 5 || slow_encode_count.is_multiple_of(100) {
debug!(
elapsed_ms = encode_elapsed_ms,
count = slow_encode_count,
@@ -676,10 +676,10 @@ impl Muxer for MacOSFragmentedM4SCameraMuxer {
}
}
- if let Ok(mut encoder) = state.encoder.lock() {
- if let Err(e) = encoder.finish_with_timestamp(timestamp) {
- warn!("Failed to finish camera segmented encoder: {e}");
- }
+ if let Ok(mut encoder) = state.encoder.lock()
+ && let Err(e) = encoder.finish_with_timestamp(timestamp)
+ {
+ warn!("Failed to finish camera segmented encoder: {e}");
}
}
@@ -744,7 +744,7 @@ impl MacOSFragmentedM4SCameraMuxer {
if convert_elapsed_ms > SLOW_THRESHOLD_MS {
slow_convert_count += 1;
- if slow_convert_count <= 5 || slow_convert_count % 100 == 0 {
+ if slow_convert_count <= 5 || slow_convert_count.is_multiple_of(100) {
debug!(
elapsed_ms = convert_elapsed_ms,
count = slow_convert_count,
@@ -759,17 +759,17 @@ impl MacOSFragmentedM4SCameraMuxer {
let encode_start = std::time::Instant::now();
let owned_frame = frame_pool.take_frame();
- if let Ok(mut encoder) = encoder_clone.lock() {
- if let Err(e) = encoder.queue_frame(owned_frame, timestamp) {
- warn!("Failed to encode camera frame: {e}");
- }
+ if let Ok(mut encoder) = encoder_clone.lock()
+ && let Err(e) = encoder.queue_frame(owned_frame, timestamp)
+ {
+ warn!("Failed to encode camera frame: {e}");
}
let encode_elapsed_ms = encode_start.elapsed().as_millis();
if encode_elapsed_ms > SLOW_THRESHOLD_MS {
slow_encode_count += 1;
- if slow_encode_count <= 5 || slow_encode_count % 100 == 0 {
+ if slow_encode_count <= 5 || slow_encode_count.is_multiple_of(100) {
debug!(
elapsed_ms = encode_elapsed_ms,
count = slow_encode_count,
diff --git a/crates/recording/src/recovery.rs b/crates/recording/src/recovery.rs
index c6512dac1..63f4ba4ed 100644
--- a/crates/recording/src/recovery.rs
+++ b/crates/recording/src/recovery.rs
@@ -518,10 +518,10 @@ impl RecoveryManager {
debug!("Failed to remove display fragment {:?}: {e}", fragment);
}
}
- if let Some(init_path) = &segment.display_init_segment {
- if let Err(e) = std::fs::remove_file(init_path) {
- debug!("Failed to remove display init segment {:?}: {e}", init_path);
- }
+ if let Some(init_path) = &segment.display_init_segment
+ && let Err(e) = std::fs::remove_file(init_path)
+ {
+ debug!("Failed to remove display init segment {:?}: {e}", init_path);
}
let display_dir = segment_dir.join("display");
if display_dir.exists()
@@ -569,10 +569,10 @@ impl RecoveryManager {
debug!("Failed to remove camera fragment {:?}: {e}", fragment);
}
}
- if let Some(init_path) = &segment.camera_init_segment {
- if let Err(e) = std::fs::remove_file(init_path) {
- debug!("Failed to remove camera init segment {:?}: {e}", init_path);
- }
+ if let Some(init_path) = &segment.camera_init_segment
+ && let Err(e) = std::fs::remove_file(init_path)
+ {
+ debug!("Failed to remove camera init segment {:?}: {e}", init_path);
}
let camera_dir = segment_dir.join("camera");
if camera_dir.exists()