Skip to content

Commit 25ebb6c

Browse files
committed
clippy
1 parent c8402e8 commit 25ebb6c

4 files changed

Lines changed: 21 additions & 30 deletions

File tree

crates/recording/examples/synthetic-test-runner.rs

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ async fn main() {
9292
vec![create_studio_mode_config(duration)]
9393
}
9494
Some(Commands::Resolution { width, height, fps }) => {
95-
println!("Testing resolution {}x{} @ {}fps...\n", width, height, fps);
95+
println!("Testing resolution {width}x{height} @ {fps}fps...\n");
9696
vec![TestConfig {
9797
video: Some(
9898
VideoTestConfig::default()
@@ -125,10 +125,7 @@ async fn main() {
125125
return;
126126
}
127127
Some(Commands::Sync { tolerance_ms }) => {
128-
println!(
129-
"Running A/V sync verification tests (tolerance: {}ms)...\n",
130-
tolerance_ms
131-
);
128+
println!("Running A/V sync verification tests (tolerance: {tolerance_ms}ms)...\n");
132129
sync_test_configs(duration, *tolerance_ms)
133130
}
134131
};
@@ -176,11 +173,11 @@ async fn main() {
176173
}
177174
TestResult::Failed { error, elapsed } => {
178175
failed += 1;
179-
println!(" \u{2717} FAILED: {}", error);
176+
println!(" \u{2717} FAILED: {error}");
180177
println!(" Duration: {:.2}s\n", elapsed.as_secs_f64());
181178
}
182179
TestResult::Skipped { reason } => {
183-
println!(" - SKIPPED: {}\n", reason);
180+
println!(" - SKIPPED: {reason}\n");
184181
}
185182
}
186183

@@ -190,17 +187,14 @@ async fn main() {
190187
let total_elapsed = start.elapsed();
191188

192189
println!("\n{}", "=".repeat(60));
193-
println!(
194-
"Summary: {}/{} passed, {} failed",
195-
passed, total_tests, failed
196-
);
190+
println!("Summary: {passed}/{total_tests} passed, {failed} failed");
197191
println!("Total time: {:.1}s", total_elapsed.as_secs_f64());
198192

199193
if failed > 0 {
200194
println!("\nFailed tests:");
201195
for (name, result) in &results {
202196
if let TestResult::Failed { error, .. } = result {
203-
println!(" - {}: {}", name, error);
197+
println!(" - {name}: {error}");
204198
}
205199
}
206200
}
@@ -237,10 +231,10 @@ enum TestResult {
237231
async fn run_synthetic_test(config: &TestConfig, output_dir: &Path, test_idx: usize) -> TestResult {
238232
let start = Instant::now();
239233

240-
let test_output_dir = output_dir.join(format!("test_{}", test_idx));
234+
let test_output_dir = output_dir.join(format!("test_{test_idx}"));
241235
if let Err(e) = std::fs::create_dir_all(&test_output_dir) {
242236
return TestResult::Failed {
243-
error: format!("Failed to create output directory: {}", e),
237+
error: format!("Failed to create output directory: {e}"),
244238
elapsed: start.elapsed(),
245239
};
246240
}
@@ -382,13 +376,13 @@ async fn run_synthetic_test(config: &TestConfig, output_dir: &Path, test_idx: us
382376
}
383377
}
384378
Err(e) => TestResult::Failed {
385-
error: format!("Validation error: {}", e),
379+
error: format!("Validation error: {e}"),
386380
elapsed,
387381
},
388382
}
389383
}
390384
Err(e) => TestResult::Failed {
391-
error: format!("Recording failed: {}", e),
385+
error: format!("Recording failed: {e}"),
392386
elapsed,
393387
},
394388
}
@@ -859,8 +853,7 @@ fn save_report(path: &PathBuf, results: &[(String, TestResult)]) {
859853
};
860854

861855
report.push_str(&format!(
862-
" {{ \"name\": \"{}\", \"status\": \"{}\", {} }}",
863-
name, status, details
856+
" {{ \"name\": \"{name}\", \"status\": \"{status}\", {details} }}"
864857
));
865858

866859
if idx < results.len() - 1 {

crates/recording/src/test_sources/audio.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ mod tests {
348348
assert_eq!(samples.len(), 1024 * 2);
349349

350350
for &sample in &samples {
351-
assert!(sample >= -1.0 && sample <= 1.0);
351+
assert!((-1.0..=1.0).contains(&sample));
352352
}
353353
}
354354

crates/recording/tests/recovery.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -415,26 +415,26 @@ fn test_recovery_error_types() {
415415
"File not found",
416416
));
417417
assert!(
418-
format!("{}", io_error).contains("IO error"),
418+
format!("{io_error}").contains("IO error"),
419419
"IO error should format correctly"
420420
);
421421

422422
let no_segments_error = RecoveryError::NoRecoverableSegments;
423423
assert!(
424-
format!("{}", no_segments_error).contains("No recoverable segments"),
424+
format!("{no_segments_error}").contains("No recoverable segments"),
425425
"NoRecoverableSegments error should format correctly"
426426
);
427427

428428
let meta_save_error = RecoveryError::MetaSave;
429429
assert!(
430-
format!("{}", meta_save_error).contains("Meta save failed"),
430+
format!("{meta_save_error}").contains("Meta save failed"),
431431
"MetaSave error should format correctly"
432432
);
433433

434434
let unplayable_error =
435435
RecoveryError::UnplayableVideo("Display video has no frames".to_string());
436436
assert!(
437-
format!("{}", unplayable_error).contains("not playable"),
437+
format!("{unplayable_error}").contains("not playable"),
438438
"UnplayableVideo error should format correctly"
439439
);
440440
}
@@ -591,8 +591,7 @@ fn test_video_file_extension_check() {
591591

592592
assert_eq!(
593593
is_video, expected_is_video,
594-
"Path {:?} video check failed",
595-
path
594+
"Path {path:?} video check failed"
596595
);
597596
}
598597
}
@@ -695,8 +694,7 @@ fn test_multiple_segment_recovery_structure() {
695694
.join("display.mp4");
696695
assert!(
697696
display_path.exists(),
698-
"Display video should exist for segment {}",
699-
i
697+
"Display video should exist for segment {i}"
700698
);
701699
}
702700
}

crates/recording/tests/synthetic_recording.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -428,20 +428,20 @@ fn test_comprehensive_config_matrix() {
428428
let has_4k = configs.iter().any(|c| {
429429
c.video
430430
.as_ref()
431-
.map_or(false, |v| v.width == 3840 && v.height == 2160)
431+
.is_some_and(|v| v.width == 3840 && v.height == 2160)
432432
});
433433
assert!(has_4k, "Should include 4K resolution");
434434

435435
let has_ultrawide = configs.iter().any(|c| {
436436
c.video
437437
.as_ref()
438-
.map_or(false, |v| v.width == 3440 && v.height == 1440)
438+
.is_some_and(|v| v.width == 3440 && v.height == 1440)
439439
});
440440
assert!(has_ultrawide, "Should include ultrawide resolution");
441441

442442
let has_60fps = configs
443443
.iter()
444-
.any(|c| c.video.as_ref().map_or(false, |v| v.frame_rate >= 60));
444+
.any(|c| c.video.as_ref().is_some_and(|v| v.frame_rate >= 60));
445445
assert!(has_60fps, "Should include 60fps or higher");
446446
}
447447

0 commit comments

Comments
 (0)