Skip to content

Commit 75d578e

Browse files
committed
clippy
1 parent 6a7a3df commit 75d578e

File tree

5 files changed

+32
-49
lines changed

5 files changed

+32
-49
lines changed

crates/recording/examples/camera-benchmark.rs

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,7 @@ async fn run_camera_encoding_benchmark(
127127
let width = first_frame.inner.width();
128128
let height = first_frame.inner.height();
129129

130-
println!(
131-
"\nCamera frame format: {:?} {}x{}",
132-
input_format, width, height
133-
);
130+
println!("\nCamera frame format: {input_format:?} {width}x{height}");
134131

135132
let output_format = Pixel::NV12;
136133
let needs_conversion = input_format != output_format;
@@ -295,13 +292,12 @@ async fn run_camera_encoding_benchmark(
295292

296293
let encode_start = Instant::now();
297294
let timestamp = Duration::from_micros(converted.frame.pts().unwrap_or(0) as u64);
298-
match encoder.queue_preconverted_frame(converted.frame, timestamp, &mut output) {
299-
Ok(()) => {
300-
let encode_duration = encode_start.elapsed();
301-
let pipeline_latency = converted.submit_time.elapsed();
302-
metrics.record_frame_encoded(encode_duration, pipeline_latency);
303-
}
304-
Err(_) => {}
295+
if let Ok(()) =
296+
encoder.queue_preconverted_frame(converted.frame, timestamp, &mut output)
297+
{
298+
let encode_duration = encode_start.elapsed();
299+
let pipeline_latency = converted.submit_time.elapsed();
300+
metrics.record_frame_encoded(encode_duration, pipeline_latency);
305301
}
306302
} else {
307303
break;
@@ -374,8 +370,8 @@ async fn main() {
374370

375371
println!("\n=== Frame Rate Test ===");
376372
let (frames, fps, inter_frame_times) = run_camera_frame_rate_test(&camera.0, 3).await;
377-
println!("Frames captured: {}", frames);
378-
println!("Average FPS: {:.1}", fps);
373+
println!("Frames captured: {frames}");
374+
println!("Average FPS: {fps:.1}");
379375

380376
if !inter_frame_times.is_empty() {
381377
let avg_interval: Duration =
@@ -384,9 +380,9 @@ async fn main() {
384380
let min_interval = inter_frame_times.iter().min().unwrap();
385381

386382
println!("Inter-frame timing:");
387-
println!(" Average: {:?}", avg_interval);
388-
println!(" Min: {:?}", min_interval);
389-
println!(" Max: {:?}", max_interval);
383+
println!(" Average: {avg_interval:?}");
384+
println!(" Min: {min_interval:?}");
385+
println!(" Max: {max_interval:?}");
390386

391387
let mut sorted = inter_frame_times.clone();
392388
sorted.sort();

crates/recording/examples/encoding-benchmark.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ fn benchmark_conversion_formats(config: &BenchmarkConfig) {
192192
println!("\n=== Format Conversion Benchmarks ===\n");
193193

194194
for (input, output, name) in formats {
195-
println!("Testing: {}", name);
195+
println!("Testing: {name}");
196196

197197
let mut cfg = config.clone();
198198
cfg.duration_secs = 5;
@@ -406,7 +406,7 @@ fn main() {
406406
"encode" => benchmark_encode_times(&config),
407407
"workers" => benchmark_worker_counts(&config),
408408
"resolutions" => benchmark_resolutions(&config),
409-
"full" | _ => {
409+
_ => {
410410
benchmark_conversion_formats(&config);
411411
benchmark_encode_times(&config);
412412
benchmark_worker_counts(&config);

crates/recording/examples/memory-leak-detector.rs

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ fn get_memory_usage() -> Option<MemoryStats> {
3939
};
4040

4141
let (footprint_mb, dirty_mb) = Command::new("footprint")
42-
.arg(&pid.to_string())
42+
.arg(pid.to_string())
4343
.output()
4444
.ok()
4545
.filter(|o| o.status.success())
@@ -128,7 +128,9 @@ struct MemoryStats {
128128
resident_mb: f64,
129129
virtual_mb: f64,
130130
footprint_mb: Option<f64>,
131+
#[allow(dead_code)]
131132
dirty_mb: Option<f64>,
133+
#[allow(dead_code)]
132134
compressed_mb: Option<f64>,
133135
}
134136

@@ -203,7 +205,7 @@ impl MemoryTracker {
203205
let current = stats.primary_metric();
204206
let delta = current - prev_memory;
205207
let delta_str = if delta.abs() > 0.5 {
206-
format!("{:+.1}", delta)
208+
format!("{delta:+.1}")
207209
} else {
208210
"~0".to_string()
209211
};
@@ -219,10 +221,10 @@ impl MemoryTracker {
219221
}
220222

221223
println!("\n=== Summary ===");
222-
println!("Duration: {:.1}s", duration_secs);
224+
println!("Duration: {duration_secs:.1}s");
223225
println!("Start RSS: {:.1} MB", first.1.primary_metric());
224226
println!("End RSS: {:.1} MB", last.1.primary_metric());
225-
println!("Total growth: {:.1} MB", memory_growth);
227+
println!("Total growth: {memory_growth:.1} MB");
226228
println!(
227229
"Growth rate: {:.2} MB/s ({:.1} MB/10s)",
228230
growth_rate,
@@ -266,10 +268,10 @@ async fn run_memory_test(
266268
) -> Result<(), Box<dyn std::error::Error>> {
267269
println!("=== Cap Memory Leak Detector ===\n");
268270
println!("Configuration:");
269-
println!(" Duration: {}s", duration_secs);
270-
println!(" Camera: {}", include_camera);
271-
println!(" Microphone: {}", include_mic);
272-
println!(" Fragmented MP4: {}", fragmented);
271+
println!(" Duration: {duration_secs}s");
272+
println!(" Camera: {include_camera}");
273+
println!(" Microphone: {include_mic}");
274+
println!(" Fragmented MP4: {fragmented}");
273275
println!();
274276

275277
let mut memory_tracker = MemoryTracker::new();
@@ -310,7 +312,7 @@ async fn run_memory_test(
310312

311313
if include_mic {
312314
if let Some((mic_name, _, _)) = MicrophoneFeed::default_device() {
313-
println!("Using microphone: {}", mic_name);
315+
println!("Using microphone: {mic_name}");
314316

315317
let error_sender = flume::unbounded().0;
316318
let mic_feed = MicrophoneFeed::spawn(MicrophoneFeed::new(error_sender));
@@ -373,7 +375,7 @@ async fn run_memory_test(
373375

374376
memory_tracker.sample();
375377

376-
println!("Stop took: {:?}", stop_duration);
378+
println!("Stop took: {stop_duration:?}");
377379
println!("Output path: {}", result.project_path.display());
378380

379381
memory_tracker.print_report();
@@ -493,16 +495,13 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
493495
println!("Second: Testing WITH fragmented MP4...\n");
494496
run_memory_test(60, include_camera, include_mic, true).await?;
495497
}
496-
"help" | _ => {
498+
_ => {
497499
println!("Cap Memory Leak Detector");
498500
println!();
499501
println!("Usage: memory-leak-detector [OPTIONS]");
500502
println!();
501503
println!("Options:");
502-
println!(
503-
" --duration <secs> Test duration (default: {})",
504-
DEFAULT_DURATION_SECS
505-
);
504+
println!(" --duration <secs> Test duration (default: {DEFAULT_DURATION_SECS})");
506505
println!(" --mode <mode> Test mode:");
507506
println!(" full Full recording pipeline with fragmented MP4 (default)");
508507
println!(" screen-only Screen recording only (no camera/mic)");

crates/recording/examples/recording-benchmark.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
265265
.unwrap_or(5);
266266
stress_test_recording(cycles, config.duration_secs).await?;
267267
}
268-
"full" | _ => {
268+
_ => {
269269
println!("Mode: Full benchmark suite\n");
270270

271271
println!("--- Screen Recording ---");

crates/rendering/src/cpu_yuv.rs

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -990,11 +990,7 @@ mod tests {
990990
let diff = (*s as i32 - *d as i32).abs();
991991
assert!(
992992
diff <= 2,
993-
"Mismatch at index {}: scalar={}, simd={}, diff={}",
994-
i,
995-
s,
996-
d,
997-
diff
993+
"Mismatch at index {i}: scalar={s}, simd={d}, diff={diff}"
998994
);
999995
}
1000996
}
@@ -1064,11 +1060,7 @@ mod tests {
10641060
let diff = (*a as i32 - *b as i32).abs();
10651061
assert!(
10661062
diff <= 2,
1067-
"Mismatch at index {}: expected={}, got={}, diff={}",
1068-
i,
1069-
a,
1070-
b,
1071-
diff
1063+
"Mismatch at index {i}: expected={a}, got={b}, diff={diff}"
10721064
);
10731065
}
10741066
}
@@ -1119,11 +1111,7 @@ mod tests {
11191111
let diff = (*s as i32 - *d as i32).abs();
11201112
assert!(
11211113
diff <= 2,
1122-
"YUV420P mismatch at index {}: scalar={}, simd={}, diff={}",
1123-
i,
1124-
s,
1125-
d,
1126-
diff
1114+
"YUV420P mismatch at index {i}: scalar={s}, simd={d}, diff={diff}"
11271115
);
11281116
}
11291117
}

0 commit comments

Comments
 (0)