Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

clippy

Richie McIlroy25ebb6c52048
diff --git a/crates/recording/examples/synthetic-test-runner.rs b/crates/recording/examples/synthetic-test-runner.rs
index 22d65a537..b645d8de3 100644
--- a/crates/recording/examples/synthetic-test-runner.rs
+++ b/crates/recording/examples/synthetic-test-runner.rs
@@ -92,7 +92,7 @@ async fn main() {
vec![create_studio_mode_config(duration)]
}
Some(Commands::Resolution { width, height, fps }) => {
- println!("Testing resolution {}x{} @ {}fps...\n", width, height, fps);
+ println!("Testing resolution {width}x{height} @ {fps}fps...\n");
vec![TestConfig {
video: Some(
VideoTestConfig::default()
@@ -125,10 +125,7 @@ async fn main() {
return;
}
Some(Commands::Sync { tolerance_ms }) => {
- println!(
- "Running A/V sync verification tests (tolerance: {}ms)...\n",
- tolerance_ms
- );
+ println!("Running A/V sync verification tests (tolerance: {tolerance_ms}ms)...\n");
sync_test_configs(duration, *tolerance_ms)
}
};
@@ -176,11 +173,11 @@ async fn main() {
}
TestResult::Failed { error, elapsed } => {
failed += 1;
- println!(" \u{2717} FAILED: {}", error);
+ println!(" \u{2717} FAILED: {error}");
println!(" Duration: {:.2}s\n", elapsed.as_secs_f64());
}
TestResult::Skipped { reason } => {
- println!(" - SKIPPED: {}\n", reason);
+ println!(" - SKIPPED: {reason}\n");
}
}
@@ -190,17 +187,14 @@ async fn main() {
let total_elapsed = start.elapsed();
println!("\n{}", "=".repeat(60));
- println!(
- "Summary: {}/{} passed, {} failed",
- passed, total_tests, failed
- );
+ println!("Summary: {passed}/{total_tests} passed, {failed} failed");
println!("Total time: {:.1}s", total_elapsed.as_secs_f64());
if failed > 0 {
println!("\nFailed tests:");
for (name, result) in &results {
if let TestResult::Failed { error, .. } = result {
- println!(" - {}: {}", name, error);
+ println!(" - {name}: {error}");
}
}
}
@@ -237,10 +231,10 @@ enum TestResult {
async fn run_synthetic_test(config: &TestConfig, output_dir: &Path, test_idx: usize) -> TestResult {
let start = Instant::now();
- let test_output_dir = output_dir.join(format!("test_{}", test_idx));
+ let test_output_dir = output_dir.join(format!("test_{test_idx}"));
if let Err(e) = std::fs::create_dir_all(&test_output_dir) {
return TestResult::Failed {
- error: format!("Failed to create output directory: {}", e),
+ error: format!("Failed to create output directory: {e}"),
elapsed: start.elapsed(),
};
}
@@ -382,13 +376,13 @@ async fn run_synthetic_test(config: &TestConfig, output_dir: &Path, test_idx: us
}
}
Err(e) => TestResult::Failed {
- error: format!("Validation error: {}", e),
+ error: format!("Validation error: {e}"),
elapsed,
},
}
}
Err(e) => TestResult::Failed {
- error: format!("Recording failed: {}", e),
+ error: format!("Recording failed: {e}"),
elapsed,
},
}
@@ -859,8 +853,7 @@ fn save_report(path: &PathBuf, results: &[(String, TestResult)]) {
};
report.push_str(&format!(
- " {{ \"name\": \"{}\", \"status\": \"{}\", {} }}",
- name, status, details
+ " {{ \"name\": \"{name}\", \"status\": \"{status}\", {details} }}"
));
if idx < results.len() - 1 {
diff --git a/crates/recording/src/test_sources/audio.rs b/crates/recording/src/test_sources/audio.rs
index e3dd6ce02..8e9cd6ff0 100644
--- a/crates/recording/src/test_sources/audio.rs
+++ b/crates/recording/src/test_sources/audio.rs
@@ -348,7 +348,7 @@ mod tests {
assert_eq!(samples.len(), 1024 * 2);
for &sample in &samples {
- assert!(sample >= -1.0 && sample <= 1.0);
+ assert!((-1.0..=1.0).contains(&sample));
}
}
diff --git a/crates/recording/tests/recovery.rs b/crates/recording/tests/recovery.rs
index 78d245e5f..6055099f1 100644
--- a/crates/recording/tests/recovery.rs
+++ b/crates/recording/tests/recovery.rs
@@ -415,26 +415,26 @@ fn test_recovery_error_types() {
"File not found",
));
assert!(
- format!("{}", io_error).contains("IO error"),
+ format!("{io_error}").contains("IO error"),
"IO error should format correctly"
);
let no_segments_error = RecoveryError::NoRecoverableSegments;
assert!(
- format!("{}", no_segments_error).contains("No recoverable segments"),
+ format!("{no_segments_error}").contains("No recoverable segments"),
"NoRecoverableSegments error should format correctly"
);
let meta_save_error = RecoveryError::MetaSave;
assert!(
- format!("{}", meta_save_error).contains("Meta save failed"),
+ format!("{meta_save_error}").contains("Meta save failed"),
"MetaSave error should format correctly"
);
let unplayable_error =
RecoveryError::UnplayableVideo("Display video has no frames".to_string());
assert!(
- format!("{}", unplayable_error).contains("not playable"),
+ format!("{unplayable_error}").contains("not playable"),
"UnplayableVideo error should format correctly"
);
}
@@ -591,8 +591,7 @@ fn test_video_file_extension_check() {
assert_eq!(
is_video, expected_is_video,
- "Path {:?} video check failed",
- path
+ "Path {path:?} video check failed"
);
}
}
@@ -695,8 +694,7 @@ fn test_multiple_segment_recovery_structure() {
.join("display.mp4");
assert!(
display_path.exists(),
- "Display video should exist for segment {}",
- i
+ "Display video should exist for segment {i}"
);
}
}
diff --git a/crates/recording/tests/synthetic_recording.rs b/crates/recording/tests/synthetic_recording.rs
index 4911e253d..aa55bc435 100644
--- a/crates/recording/tests/synthetic_recording.rs
+++ b/crates/recording/tests/synthetic_recording.rs
@@ -428,20 +428,20 @@ fn test_comprehensive_config_matrix() {
let has_4k = configs.iter().any(|c| {
c.video
.as_ref()
- .map_or(false, |v| v.width == 3840 && v.height == 2160)
+ .is_some_and(|v| v.width == 3840 && v.height == 2160)
});
assert!(has_4k, "Should include 4K resolution");
let has_ultrawide = configs.iter().any(|c| {
c.video
.as_ref()
- .map_or(false, |v| v.width == 3440 && v.height == 1440)
+ .is_some_and(|v| v.width == 3440 && v.height == 1440)
});
assert!(has_ultrawide, "Should include ultrawide resolution");
let has_60fps = configs
.iter()
- .any(|c| c.video.as_ref().map_or(false, |v| v.frame_rate >= 60));
+ .any(|c| c.video.as_ref().is_some_and(|v| v.frame_rate >= 60));
assert!(has_60fps, "Should include 60fps or higher");
}