Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
clippy
Richie McIlroy5d209973b016
diff --git a/crates/export/src/mp4.rs b/crates/export/src/mp4.rsindex 569f8b7f0..325515b05 100644--- a/crates/export/src/mp4.rs+++ b/crates/export/src/mp4.rs@@ -152,8 +152,7 @@ impl Mp4ExportSettings {MAX_CONSECUTIVE_TIMEOUTS);return Err(format!(- "Export timed out {} times consecutively after {}s each waiting for frame {} - GPU/decoder may be unresponsive",- MAX_CONSECUTIVE_TIMEOUTS, timeout_secs, frame_count+ "Export timed out {MAX_CONSECUTIVE_TIMEOUTS} times consecutively after {timeout_secs}s each waiting for frame {frame_count} - GPU/decoder may be unresponsive"));}diff --git a/crates/recording/examples/playback-test-runner.rs b/crates/recording/examples/playback-test-runner.rsindex 7c6d83e45..adfe615f7 100644--- a/crates/recording/examples/playback-test-runner.rs+++ b/crates/recording/examples/playback-test-runner.rs@@ -171,10 +171,10 @@ impl RecordingTestReport {result.is_hardware_accelerated);if let Some(reason) = &result.fallback_reason {- println!(" Fallback: {}", reason);+ println!(" Fallback: {reason}");}for err in &result.errors {- println!(" ERROR: {}", err);+ println!(" ERROR: {err}");}}@@ -203,13 +203,10 @@ impl RecordingTestReport {println!(" WARN: FPS outside tolerance!");}if !result.decode_latency_ok {- println!(- " WARN: Decode latency exceeds {}ms!",- DECODE_LATENCY_WARNING_MS- );+ println!(" WARN: Decode latency exceeds {DECODE_LATENCY_WARNING_MS}ms!");}for err in &result.errors {- println!(" ERROR: {}", err);+ println!(" ERROR: {err}");}}@@ -249,7 +246,7 @@ impl RecordingTestReport {);}for err in &result.errors {- println!(" ERROR: {}", err);+ println!(" ERROR: {err}");}}}@@ -261,7 +258,7 @@ impl RecordingTestReport {if result.has_camera {let drift_str = result.camera_display_drift_ms- .map(|d| format!("{:.1}ms", d))+ .map(|d| format!("{d:.1}ms")).unwrap_or_else(|| "N/A".to_string());println!(" Segment {}: [{}] drift={} frames={}(cam)/{}(disp)",@@ -273,15 +270,14 @@ impl RecordingTestReport {);if !result.drift_ok {println!(- " WARN: Camera-display drift exceeds {}ms!",- CAMERA_SYNC_TOLERANCE_MS+ " WARN: Camera-display drift exceeds {CAMERA_SYNC_TOLERANCE_MS}ms!");}} else {println!(" Segment {}: No camera", result.segment_index);}for err in &result.errors {- println!(" ERROR: {}", err);+ println!(" ERROR: {err}");}}}@@ -321,7 +317,7 @@ async fn test_decoder(video_path: &Path, fps: u32, is_camera: bool) -> DecoderTe}Err(e) => {result.init_time_ms = start.elapsed().as_secs_f64() * 1000.0;- result.errors.push(format!("Decoder init failed: {}", e));+ result.errors.push(format!("Decoder init failed: {e}"));result.passed = false;}}@@ -354,9 +350,7 @@ async fn test_playback(let decoder = match spawn_decoder("display", display_path.clone(), fps, 0.0).await {Ok(d) => d,Err(e) => {- result- .errors- .push(format!("Failed to create decoder: {}", e));+ result.errors.push(format!("Failed to create decoder: {e}"));return result;}};@@ -385,7 +379,7 @@ async fn test_playback(if frame.width() == 0 || frame.height() == 0 {result.errors- .push(format!("Frame {} has zero dimensions", frame_num));+ .push(format!("Frame {frame_num} has zero dimensions"));}if verbose && frame_num % 30 == 0 {@@ -402,7 +396,7 @@ async fn test_playback(None => {failed_count += 1;if verbose {- println!(" Frame {}: FAILED", frame_num);+ println!(" Frame {frame_num}: FAILED");}}}@@ -500,9 +494,7 @@ async fn test_audio_sync(}}Err(e) => {- result- .errors- .push(format!("Failed to load mic audio: {}", e));+ result.errors.push(format!("Failed to load mic audio: {e}"));}}}@@ -521,7 +513,7 @@ async fn test_audio_sync(Err(e) => {result.errors- .push(format!("Failed to load system audio: {}", e));+ .push(format!("Failed to load system audio: {e}"));}}}@@ -592,7 +584,7 @@ async fn test_camera_sync(Err(e) => {result.errors- .push(format!("Failed to create display decoder: {}", e));+ .push(format!("Failed to create display decoder: {e}"));return result;}};@@ -605,7 +597,7 @@ async fn test_camera_sync(Err(e) => {result.errors- .push(format!("Failed to create camera decoder: {}", e));+ .push(format!("Failed to create camera decoder: {e}"));result.camera_decoder_ok = false;return result;}@@ -791,7 +783,7 @@ async fn run_tests_on_recording(};if verbose {- println!(" Testing decoder for segment {} display...", segment_idx);+ println!(" Testing decoder for segment {segment_idx} display...");}let decoder_result = test_decoder(&display_path, fps, false).await;report.decoder_results.push(decoder_result);@@ -808,7 +800,7 @@ async fn run_tests_on_recording(if let Some(cam_path) = camera_path {if verbose {- println!(" Testing decoder for segment {} camera...", segment_idx);+ println!(" Testing decoder for segment {segment_idx} camera...");}let cam_decoder_result = test_decoder(&cam_path, fps, true).await;report.decoder_results.push(cam_decoder_result);@@ -817,7 +809,7 @@ async fn run_tests_on_recording(if run_playback {if verbose {- println!(" Testing playback for segment {}...", segment_idx);+ println!(" Testing playback for segment {segment_idx}...");}let playback_result =test_playback(&meta, studio_meta.as_ref(), segment_idx, fps, verbose).await;@@ -826,7 +818,7 @@ async fn run_tests_on_recording(if run_audio_sync {if verbose {- println!(" Testing audio sync for segment {}...", segment_idx);+ println!(" Testing audio sync for segment {segment_idx}...");}let audio_result = test_audio_sync(&meta, studio_meta.as_ref(), segment_idx, fps).await;report.audio_sync_results.push(audio_result);@@ -834,7 +826,7 @@ async fn run_tests_on_recording(if run_camera_sync && has_camera {if verbose {- println!(" Testing camera sync for segment {}...", segment_idx);+ println!(" Testing camera sync for segment {segment_idx}...");}let camera_result =test_camera_sync(&meta, studio_meta.as_ref(), segment_idx, fps).await;@@ -862,7 +854,7 @@ fn print_summary(reports: &[RecordingTestReport]) {let passed = reports.iter().filter(|r| r.overall_passed).count();let total = reports.len();- println!("\nResults: {}/{} recordings passed", passed, total);+ println!("\nResults: {passed}/{total} recordings passed");if passed < total {println!("\nFailed recordings:");@@ -904,24 +896,21 @@ async fn main() -> anyhow::Result<()> {let cli = Cli::parse();- match cli.command {- Some(Commands::List) => {- let recordings = discover_recordings(&cli.input_dir);- if recordings.is_empty() {- println!("No recordings found in {}", cli.input_dir.display());- } else {- println!("Found {} recordings:", recordings.len());- for recording in recordings {- if let Ok(meta) = RecordingMeta::load_for_project(&recording) {- println!(" - {} ({})", meta.pretty_name, recording.display());- } else {- println!(" - {}", recording.display());- }+ if let Some(Commands::List) = cli.command {+ let recordings = discover_recordings(&cli.input_dir);+ if recordings.is_empty() {+ println!("No recordings found in {}", cli.input_dir.display());+ } else {+ println!("Found {} recordings:", recordings.len());+ for recording in recordings {+ if let Ok(meta) = RecordingMeta::load_for_project(&recording) {+ println!(" - {} ({})", meta.pretty_name, recording.display());+ } else {+ println!(" - {}", recording.display());}}- return Ok(());}- _ => {}+ return Ok(());}let recordings = if let Some(path) = cli.recording_path {@@ -980,7 +969,7 @@ async fn main() -> anyhow::Result<()> {reports.push(report);}Err(e) => {- println!(" ERROR: {}", e);+ println!(" ERROR: {e}");}}}diff --git a/crates/recording/examples/real-device-test-runner.rs b/crates/recording/examples/real-device-test-runner.rsindex cd0c24f9f..91eea9cdc 100644--- a/crates/recording/examples/real-device-test-runner.rs+++ b/crates/recording/examples/real-device-test-runner.rs@@ -96,7 +96,7 @@ impl AvailableDevices {);if let Some(mic) = &self.default_microphone {- println!(" Default Microphone: {}", mic);+ println!(" Default Microphone: {mic}");} else {println!(" Default Microphone: None");}@@ -439,7 +439,7 @@ impl TestReport {println!(" No camera output found");}for issue in &self.camera_output.issues {- println!(" ISSUE: {}", issue);+ println!(" ISSUE: {issue}");}}}@@ -492,16 +492,10 @@ impl TestReport {println!(" WARN: FPS outside tolerance!");}if !seg.jitter_ok {- println!(- " WARN: Frame jitter exceeds {}ms!",- JITTER_TOLERANCE_MS- );+ println!(" WARN: Frame jitter exceeds {JITTER_TOLERANCE_MS}ms!");}if !seg.dropped_ok {- println!(- " WARN: Dropped frames exceed {}%!",- MAX_DROPPED_FRAME_PERCENT- );+ println!(" WARN: Dropped frames exceed {MAX_DROPPED_FRAME_PERCENT}%!");}}@@ -518,7 +512,7 @@ impl TestReport {if let Some(ref mic) = seg.mic {let diff_str = seg.mic_video_duration_diff_ms- .map(|d| format!("{:.1}ms", d))+ .map(|d| format!("{d:.1}ms")).unwrap_or_else(|| "N/A".to_string());let gap_str = if mic.has_gaps {format!(@@ -542,7 +536,7 @@ impl TestReport {if let Some(ref sys) = seg.system_audio {let diff_str = seg.system_audio_video_duration_diff_ms- .map(|d| format!("{:.1}ms", d))+ .map(|d| format!("{d:.1}ms")).unwrap_or_else(|| "N/A".to_string());let gap_str = if sys.has_gaps {format!(@@ -568,7 +562,7 @@ impl TestReport {if !self.errors.is_empty() {println!(" Errors:");for error in &self.errors {- println!(" - {}", error);+ println!(" - {error}");}}@@ -673,8 +667,7 @@ fn validate_camera_output(meta: &RecordingMeta, fragmented: bool) -> CameraOutpuif !result.has_init_mp4 {result.valid = false;result.issues.push(format!(- "Segment {}: Missing init.mp4 in camera fragmented output",- idx+ "Segment {idx}: Missing init.mp4 in camera fragmented output"));}@@ -687,22 +680,19 @@ fn validate_camera_output(meta: &RecordingMeta, fragmented: bool) -> CameraOutpuif result.fragment_count == 0 {result.valid = false;- result.issues.push(format!(- "Segment {}: No .m4s fragments in camera output",- idx- ));+ result+ .issues+ .push(format!("Segment {idx}: No .m4s fragments in camera output"));}} else if camera_path.is_file() {result.valid = false;result.issues.push(format!(- "Segment {}: Camera output is a single file, expected fragmented directory",- idx+ "Segment {idx}: Camera output is a single file, expected fragmented directory"));} else {result.valid = false;result.issues.push(format!(- "Segment {}: Camera output path does not exist: {:?}",- idx, camera_path+ "Segment {idx}: Camera output path does not exist: {camera_path:?}"));}}@@ -1463,7 +1453,7 @@ async fn run_test(let recording_dir = match recording_result {Ok(dir) => dir,Err(e) => {- report.errors.push(format!("Recording failed: {}", e));+ report.errors.push(format!("Recording failed: {e}"));report.elapsed = start.elapsed();return report;}@@ -1474,7 +1464,7 @@ async fn run_test(Err(e) => {report.errors- .push(format!("Failed to load recording metadata: {}", e));+ .push(format!("Failed to load recording metadata: {e}"));report.elapsed = start.elapsed();return report;}@@ -1500,7 +1490,7 @@ async fn run_test(Err(e) => {report.errors- .push(format!("Duration validation failed: {}", e));+ .push(format!("Duration validation failed: {e}"));}}@@ -1589,7 +1579,7 @@ fn print_summary(reports: &[TestReport]) {let total = reports.len();println!("\n{}", "=".repeat(70));- println!("SUMMARY: {}/{} tests passed", passed, total);+ println!("SUMMARY: {passed}/{total} tests passed");if passed < total {println!("\nFailed tests:");@@ -1706,7 +1696,7 @@ async fn main() -> anyhow::Result<()> {println!("Camera: ENABLED (use --no-camera to disable)");if devices.default_microphone.is_some() {println!(" Testing A/V sync between camera and microphone");- println!(" Sync tolerance: {}ms", SYNC_TOLERANCE_MS);+ println!(" Sync tolerance: {SYNC_TOLERANCE_MS}ms");} else {println!(" WARNING: No microphone available - A/V sync validation limited");}diff --git a/crates/recording/src/resolution_limits.rs b/crates/recording/src/resolution_limits.rsindex 33af77c07..9ee04e4d7 100644--- a/crates/recording/src/resolution_limits.rs+++ b/crates/recording/src/resolution_limits.rs@@ -65,12 +65,12 @@ mod tests {fn assert_valid_output(result: Option<(u32, u32)>, max_dim: u32) {if let Some((w, h)) = result {- assert!(w <= max_dim, "Width {} exceeds max {}", w, max_dim);- assert!(h <= max_dim, "Height {} exceeds max {}", h, max_dim);- assert_eq!(w % 2, 0, "Width {} is odd", w);- assert_eq!(h % 2, 0, "Height {} is odd", h);- assert!(w >= 2, "Width {} is too small", w);- assert!(h >= 2, "Height {} is too small", h);+ assert!(w <= max_dim, "Width {w} exceeds max {max_dim}");+ assert!(h <= max_dim, "Height {h} exceeds max {max_dim}");+ assert_eq!(w % 2, 0, "Width {w} is odd");+ assert_eq!(h % 2, 0, "Height {h} is odd");+ assert!(w >= 2, "Width {w} is too small");+ assert!(h >= 2, "Height {h} is too small");}}@@ -85,9 +85,7 @@ mod tests {let result_aspect = result_w as f64 / result_h as f64;assert!((original_aspect - result_aspect).abs() < tolerance,- "Aspect ratio changed too much: {} -> {}",- original_aspect,- result_aspect+ "Aspect ratio changed too much: {original_aspect} -> {result_aspect}");}@@ -226,7 +224,7 @@ mod tests {for (w, h) in browser_sizes {let result = calculate_gpu_compatible_size(w, h, 4096);if w % 2 != 0 || h % 2 != 0 {- assert!(result.is_some(), "Should adjust odd dimensions {}x{}", w, h);+ assert!(result.is_some(), "Should adjust odd dimensions {w}x{h}");}assert_valid_output(result, 4096);}@@ -396,11 +394,7 @@ mod tests {let result = calculate_gpu_compatible_size(w, h, 4096);assert_valid_output(result, 4096);if w % 2 == 0 && h % 2 == 0 && w <= 4096 && h <= 4096 {- assert_eq!(- result, None,- "Even dimensions {}x{} should return None",- w, h- );+ assert_eq!(result, None, "Even dimensions {w}x{h} should return None");}}}@@ -418,16 +412,8 @@ mod tests {let result = calculate_gpu_compatible_size(in_w, in_h, 4096);assert!(result.is_some());let (w, h) = result.unwrap();- assert_eq!(- w, exp_w,- "Expected width {} for input {}x{}",- exp_w, in_w, in_h- );- assert_eq!(- h, exp_h,- "Expected height {} for input {}x{}",- exp_h, in_w, in_h- );+ assert_eq!(w, exp_w, "Expected width {exp_w} for input {in_w}x{in_h}");+ assert_eq!(h, exp_h, "Expected height {exp_h} for input {in_w}x{in_h}");}}@@ -493,15 +479,12 @@ mod tests {if w <= 4096 && h <= 4096 && w % 2 == 0 && h % 2 == 0 {assert_eq!(result, None,- "Standard resolution {}x{} should return None",- w, h+ "Standard resolution {w}x{h} should return None");} else if w > 4096 || h > 4096 {assert!(result.is_some(),- "Over-limit resolution {}x{} should downscale",- w,- h+ "Over-limit resolution {w}x{h} should downscale");}}