Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
clippy
Richie McIlroy3c8e4a36fdb3
diff --git a/crates/camera-directshow/examples/cli.rs b/crates/camera-directshow/examples/cli.rsindex f154aa99a..00161139d 100644--- a/crates/camera-directshow/examples/cli.rs+++ b/crates/camera-directshow/examples/cli.rs@@ -56,7 +56,7 @@ mod windows {return None;}- let video_info = &*media_type.video_info();+ let video_info = media_type.video_info();let width = video_info.bmiHeader.biWidth;let height = video_info.bmiHeader.biHeight;@@ -114,7 +114,7 @@ mod windows {.start_capturing(&selected_format.media_type,Box::new(|frame| {- let data_length = unsafe { frame.sample.GetActualDataLength() };+ let data_length = frame.sample.GetActualDataLength();println!("Frame: data_length={data_length:?}, timestamp={:?}",frame.timestampdiff --git a/crates/camera-windows/examples/cli.rs b/crates/camera-windows/examples/cli.rsindex fbf898bc0..472555684 100644--- a/crates/camera-windows/examples/cli.rs+++ b/crates/camera-windows/examples/cli.rs@@ -69,5 +69,6 @@ mod windows {}}+ #[allow(dead_code)]pub struct FormatSelection(VideoFormat);}diff --git a/crates/cursor-info/examples/cli.rs b/crates/cursor-info/examples/cli.rsindex 7bb589fab..cee2b8fdf 100644--- a/crates/cursor-info/examples/cli.rs+++ b/crates/cursor-info/examples/cli.rs@@ -1,7 +1,10 @@-use std::collections::HashMap;--use cap_cursor_info::{CursorShape, CursorShapeMacOS};+use cap_cursor_info::CursorShape;+#[cfg(target_os = "macos")]+use cap_cursor_info::CursorShapeMacOS;+#[cfg(target_os = "macos")]use sha2::{Digest, Sha256};+#[cfg(target_os = "macos")]+use std::collections::HashMap;#[allow(unreachable_code)]fn main() {@@ -103,7 +106,7 @@ fn run() {// Try to convert HCURSOR to CursorShape using the TryFrom implementationmatch CursorShape::try_from(&cursor_info.hCursor) {Ok(cursor_shape) => {- println!("CursorShape: {}", cursor_shape);+ println!("CursorShape: {cursor_shape}");}Err(_) => {println!("Unknown cursor: {:?}", cursor_info.hCursor);diff --git a/crates/enc-mediafoundation/examples/cli.rs b/crates/enc-mediafoundation/examples/cli.rsindex f24f0a4fa..458bfb8cc 100644--- a/crates/enc-mediafoundation/examples/cli.rs+++ b/crates/enc-mediafoundation/examples/cli.rs@@ -18,7 +18,7 @@ mod win {Foundation::{Metadata::ApiInformation, TimeSpan},Graphics::Capture::GraphicsCaptureSession,Win32::{- Media::MediaFoundation::{self, MFSTARTUP_FULL, MFStartup},+ Media::MediaFoundation::{MFSTARTUP_FULL, MFStartup},System::{Diagnostics::Debug::{DebugBreak, IsDebuggerPresent},Threading::GetCurrentProcessId,@@ -44,7 +44,7 @@ mod win {if wait_for_debugger {let pid = unsafe { GetCurrentProcessId() };- println!("Waiting for a debugger to attach (PID: {})...", pid);+ println!("Waiting for a debugger to attach (PID: {pid})...");loop {if unsafe { IsDebuggerPresent().into() } {break;@@ -64,10 +64,7 @@ mod win {}if verbose {- println!(- "Using index \"{}\" and path \"{}\".",- display_index, output_path- );+ println!("Using index \"{display_index}\" and path \"{output_path}\".");}let item = Display::primary()@@ -77,7 +74,7 @@ mod win {// Resolve encoding settingslet resolution = item.Size()?;- let bit_rate = bit_rate * 1000000;+ let _bit_rate = bit_rate * 1000000;// Start the recording{@@ -125,7 +122,7 @@ mod win {).unwrap();- let output_path = std::env::current_dir().unwrap().join(output_path);+ let _output_path = std::env::current_dir().unwrap().join(output_path);// let sample_writer = Arc::new(SampleWriter::new(output_path.as_path())?);@@ -216,7 +213,7 @@ mod win {}fn exit_with_error(message: &str) -> ! {- println!("{}", message);+ println!("{message}");std::process::exit(1);}@@ -289,6 +286,7 @@ mod win {}}+ #[allow(dead_code)]mod hotkey {use std::sync::atomic::{AtomicI32, Ordering};use windows::{diff --git a/crates/frame-converter/src/d3d11.rs b/crates/frame-converter/src/d3d11.rsindex af77267b3..36e69371e 100644--- a/crates/frame-converter/src/d3d11.rs+++ b/crates/frame-converter/src/d3d11.rs@@ -435,8 +435,7 @@ impl D3D11Converter {).map_err(|e| {ConvertError::HardwareUnavailable(format!(- "D3D11CreateDevice failed on {}: {e:?}",- adapter_name+ "D3D11CreateDevice failed on {adapter_name}: {e:?}"))})?;diff --git a/crates/recording/examples/camera-benchmark.rs b/crates/recording/examples/camera-benchmark.rsindex 05f00ff41..5ad07ad52 100644--- a/crates/recording/examples/camera-benchmark.rs+++ b/crates/recording/examples/camera-benchmark.rs@@ -127,10 +127,7 @@ async fn run_camera_encoding_benchmark(let width = first_frame.inner.width();let height = first_frame.inner.height();- println!(- "\nCamera frame format: {:?} {}x{}",- input_format, width, height- );+ println!("\nCamera frame format: {input_format:?} {width}x{height}");let output_format = Pixel::NV12;let needs_conversion = input_format != output_format;@@ -295,13 +292,12 @@ async fn run_camera_encoding_benchmark(let encode_start = Instant::now();let timestamp = Duration::from_micros(converted.frame.pts().unwrap_or(0) as u64);- match encoder.queue_preconverted_frame(converted.frame, timestamp, &mut output) {- Ok(()) => {- let encode_duration = encode_start.elapsed();- let pipeline_latency = converted.submit_time.elapsed();- metrics.record_frame_encoded(encode_duration, pipeline_latency);- }- Err(_) => {}+ if let Ok(()) =+ encoder.queue_preconverted_frame(converted.frame, timestamp, &mut output)+ {+ let encode_duration = encode_start.elapsed();+ let pipeline_latency = converted.submit_time.elapsed();+ metrics.record_frame_encoded(encode_duration, pipeline_latency);}} else {break;@@ -374,8 +370,8 @@ async fn main() {println!("\n=== Frame Rate Test ===");let (frames, fps, inter_frame_times) = run_camera_frame_rate_test(&camera.0, 3).await;- println!("Frames captured: {}", frames);- println!("Average FPS: {:.1}", fps);+ println!("Frames captured: {frames}");+ println!("Average FPS: {fps:.1}");if !inter_frame_times.is_empty() {let avg_interval: Duration =@@ -384,9 +380,9 @@ async fn main() {let min_interval = inter_frame_times.iter().min().unwrap();println!("Inter-frame timing:");- println!(" Average: {:?}", avg_interval);- println!(" Min: {:?}", min_interval);- println!(" Max: {:?}", max_interval);+ println!(" Average: {avg_interval:?}");+ println!(" Min: {min_interval:?}");+ println!(" Max: {max_interval:?}");let mut sorted = inter_frame_times.clone();sorted.sort();diff --git a/crates/recording/examples/encoding-benchmark.rs b/crates/recording/examples/encoding-benchmark.rsindex 8169e30ff..d9e62ad59 100644--- a/crates/recording/examples/encoding-benchmark.rs+++ b/crates/recording/examples/encoding-benchmark.rs@@ -192,7 +192,7 @@ fn benchmark_conversion_formats(config: &BenchmarkConfig) {println!("\n=== Format Conversion Benchmarks ===\n");for (input, output, name) in formats {- println!("Testing: {}", name);+ println!("Testing: {name}");let mut cfg = config.clone();cfg.duration_secs = 5;@@ -406,7 +406,7 @@ fn main() {"encode" => benchmark_encode_times(&config),"workers" => benchmark_worker_counts(&config),"resolutions" => benchmark_resolutions(&config),- "full" | _ => {+ _ => {benchmark_conversion_formats(&config);benchmark_encode_times(&config);benchmark_worker_counts(&config);diff --git a/crates/recording/examples/recording-benchmark.rs b/crates/recording/examples/recording-benchmark.rsindex 87adbe7da..13eab946f 100644--- a/crates/recording/examples/recording-benchmark.rs+++ b/crates/recording/examples/recording-benchmark.rs@@ -265,7 +265,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {.unwrap_or(5);stress_test_recording(cycles, config.duration_secs).await?;}- "full" | _ => {+ _ => {println!("Mode: Full benchmark suite\n");println!("--- Screen Recording ---");diff --git a/crates/recording/tests/hardware_compat.rs b/crates/recording/tests/hardware_compat.rsindex d5c940caa..6900012e6 100644--- a/crates/recording/tests/hardware_compat.rs+++ b/crates/recording/tests/hardware_compat.rs@@ -187,7 +187,7 @@ fn test_gpu_detection() {println!(" -> Microsoft WARP: Software rendering/encoding");}cap_frame_converter::GpuVendor::Unknown(id) => {- println!(" -> Unknown GPU vendor (0x{:04X}): Software fallback", id);+ println!(" -> Unknown GPU vendor (0x{id:04X}): Software fallback");}}} else {@@ -200,7 +200,7 @@ fn test_graphics_capture_support() {test_utils::init_tracing();let supported = scap_direct3d::is_supported().unwrap_or(false);- println!("Windows Graphics Capture API supported: {}", supported);+ println!("Windows Graphics Capture API supported: {supported}");if !supported {let version = scap_direct3d::WindowsVersion::detect();@@ -232,7 +232,7 @@ fn test_camera_enumeration() {println!("Device ID: {}", camera.device_id());if let Some(model_id) = camera.model_id() {- println!("Model ID: {}", model_id);+ println!("Model ID: {model_id}");}if let Some(formats) = camera.formats() {@@ -251,7 +251,7 @@ fn test_camera_enumeration() {for (resolution, frame_rates) in format_summary.iter() {let rates: Vec<String> = frame_rates.iter()- .map(|(_, _, fps)| format!("{:.1}fps", fps))+ .map(|(_, _, fps)| format!("{fps:.1}fps")).collect();println!(" {}: {}", resolution, rates.join(", "));}@@ -289,14 +289,14 @@ fn test_encoder_availability_matrix() {for (name, description) in h264_encoders {let available = ffmpeg::encoder::find_by_name(name).is_some();let status = if available { "✓" } else { "✗" };- println!(" {} {} ({})", status, description, name);+ println!(" {status} {description} ({name})");}println!("\n=== HEVC/H.265 Encoder Availability ===");for (name, description) in hevc_encoders {let available = ffmpeg::encoder::find_by_name(name).is_some();let status = if available { "✓" } else { "✗" };- println!(" {} {} ({})", status, description, name);+ println!(" {status} {description} ({name})");}let gpu = cap_frame_converter::detect_primary_gpu();@@ -374,11 +374,11 @@ fn test_d3d11_converter_capability() {};println!(" ✓ {}: {} ({:?})", name, hw, result.backend);if let Some(reason) = result.fallback_reason {- println!(" Fallback: {}", reason);+ println!(" Fallback: {reason}");}}Err(e) => {- println!(" ✗ {}: Failed - {}", name, e);+ println!(" ✗ {name}: Failed - {e}");}}}@@ -402,7 +402,7 @@ fn test_supported_pixel_formats() {for (format, name) in formats {let supported = cap_frame_converter::is_format_supported(format);let status = if supported { "✓" } else { "✗" };- println!(" {} {}", status, name);+ println!(" {status} {name}");}}@@ -560,14 +560,14 @@ fn test_camera_capture_basic() {std::thread::sleep(Duration::from_secs(2));let frames = frame_count.load(std::sync::atomic::Ordering::Relaxed);- println!("Captured {} frames in 2 seconds", frames);+ println!("Captured {frames} frames in 2 seconds");let _ = handle.stop_capturing();assert!(frames > 0, "Should have captured at least one frame");}Err(e) => {- println!("Failed to start capture: {:?}", e);+ println!("Failed to start capture: {e:?}");}}}@@ -678,7 +678,7 @@ fn test_hardware_compatibility_summary() {} else {"? Unknown".to_string()};- println!("║ Windows: {:<52} ║", windows_status);+ println!("║ Windows: {windows_status:<52} ║");let gpu_status = if let Some(g) = gpu {format!(@@ -689,21 +689,21 @@ fn test_hardware_compatibility_summary() {} else {"⚠ No GPU (WARP software rendering)".to_string()};- println!("║ GPU: {:<56} ║", gpu_status);+ println!("║ GPU: {gpu_status:<56} ║");let capture_status = if diagnostics.graphics_capture_supported {"✓ Available"} else {"✗ Unavailable"};- println!("║ Screen Capture: {:<45} ║", capture_status);+ println!("║ Screen Capture: {capture_status:<45} ║");let d3d11_status = if diagnostics.d3d11_video_processor_available {"✓ GPU accelerated"} else {"⚠ CPU fallback (swscale)"};- println!("║ Frame Conversion: {:<43} ║", d3d11_status);+ println!("║ Frame Conversion: {d3d11_status:<43} ║");let hw_encoders: Vec<&str> = diagnostics.available_encoders@@ -716,11 +716,11 @@ fn test_hardware_compatibility_summary() {} else {"⚠ Software only (libx264)".to_string()};- println!("║ Encoding: {:<51} ║", encoder_status);+ println!("║ Encoding: {encoder_status:<51} ║");let cameras: Vec<cap_camera::CameraInfo> = cap_camera::list_cameras().collect();let camera_status = format!("{} camera(s) detected", cameras.len());- println!("║ Cameras: {:<52} ║", camera_status);+ println!("║ Cameras: {camera_status:<52} ║");println!("╠════════════════════════════════════════════════════════════════╣");@@ -792,10 +792,7 @@ fn test_frame_conversion_performance() {let avg_ms = elapsed.as_secs_f64() * 1000.0 / test_iterations as f64;let fps_capacity = 1000.0 / avg_ms;- println!(- "Performance: {:.2}ms/frame avg ({:.1} fps capacity)",- avg_ms, fps_capacity- );+ println!("Performance: {avg_ms:.2}ms/frame avg ({fps_capacity:.1} fps capacity)");let target_fps = 60.0;let target_ms = 1000.0 / target_fps;@@ -902,7 +899,7 @@ fn test_minimum_requirements_check() {.collect();if !hw_encoders.is_empty() {- println!(" ✓ Hardware video encoder ({:?})", hw_encoders);+ println!(" ✓ Hardware video encoder ({hw_encoders:?})");} else {println!(" ⚠ No hardware encoders (will use CPU encoding)");warnings.push("CPU encoding may impact system performance");@@ -921,7 +918,7 @@ fn test_minimum_requirements_check() {} else if requirements_met {println!("⚠ Requirements met with warnings:");for warning in &warnings {- println!(" - {}", warning);+ println!(" - {warning}");}} else {println!("✗ Missing required components - Cap may not function correctly");diff --git a/crates/rendering/src/cpu_yuv.rs b/crates/rendering/src/cpu_yuv.rsindex 7dbb0a26b..ea929e535 100644--- a/crates/rendering/src/cpu_yuv.rs+++ b/crates/rendering/src/cpu_yuv.rs@@ -990,11 +990,7 @@ mod tests {let diff = (*s as i32 - *d as i32).abs();assert!(diff <= 2,- "Mismatch at index {}: scalar={}, simd={}, diff={}",- i,- s,- d,- diff+ "Mismatch at index {i}: scalar={s}, simd={d}, diff={diff}");}}@@ -1064,11 +1060,7 @@ mod tests {let diff = (*a as i32 - *b as i32).abs();assert!(diff <= 2,- "Mismatch at index {}: expected={}, got={}, diff={}",- i,- a,- b,- diff+ "Mismatch at index {i}: expected={a}, got={b}, diff={diff}");}}@@ -1119,11 +1111,7 @@ mod tests {let diff = (*s as i32 - *d as i32).abs();assert!(diff <= 2,- "YUV420P mismatch at index {}: scalar={}, simd={}, diff={}",- i,- s,- d,- diff+ "YUV420P mismatch at index {i}: scalar={s}, simd={d}, diff={diff}");}}diff --git a/crates/scap-direct3d/examples/cli.rs b/crates/scap-direct3d/examples/cli.rsindex cc8020267..faaa65a54 100644--- a/crates/scap-direct3d/examples/cli.rs+++ b/crates/scap-direct3d/examples/cli.rs@@ -5,15 +5,12 @@ fn main() {#[cfg(windows)]mod windows {- use scap_direct3d::{Capturer, PixelFormat, Settings};- use scap_ffmpeg::*;use scap_targets::*;use std::time::Duration;- use windows::Win32::Graphics::Direct3D11::D3D11_BOX;pub fn main() {let display = Display::primary();- let display = display.raw_handle();+ let _display = display.raw_handle();// let mut capturer = Capturer::new(// display.try_as_capture_item().unwrap(),