Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

clippy

Richie McIlroy7bef34ce2f51
diff --git a/crates/cap-test/src/config/types.rs b/crates/cap-test/src/config/types.rs
index 41bf81d10..2708ba403 100644
--- a/crates/cap-test/src/config/types.rs
+++ b/crates/cap-test/src/config/types.rs
@@ -136,21 +136,12 @@ impl Default for CameraConfig {
}
}
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct AudioConfig {
pub microphones: MicrophoneConfig,
pub system: SystemAudioConfig,
}
-impl Default for AudioConfig {
- fn default() -> Self {
- Self {
- microphones: MicrophoneConfig::default(),
- system: SystemAudioConfig::default(),
- }
- }
-}
-
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct MicrophoneConfig {
#[serde(default = "default_sample_rates")]
diff --git a/crates/cap-test/src/matrix/runner.rs b/crates/cap-test/src/matrix/runner.rs
index 83152fb77..b90ab5f38 100644
--- a/crates/cap-test/src/matrix/runner.rs
+++ b/crates/cap-test/src/matrix/runner.rs
@@ -362,39 +362,39 @@ impl CompatMatrixRunner {
let mut blocking_failures = Vec::new();
for result in &matrix_results.results {
- if let Some(classification) = classify_test_failure(result) {
- if classification.is_blocking() {
- blocking_failures.push(BlockingFailure {
- test_id: result.test_id.clone(),
- test_name: result.name.clone(),
- classification,
- reason: result
- .failure_reason
- .clone()
- .unwrap_or_else(|| "Unknown failure".to_string()),
- reproduction_steps: build_reproduction_steps(result),
- });
- }
+ if let Some(classification) = classify_test_failure(result)
+ && classification.is_blocking()
+ {
+ blocking_failures.push(BlockingFailure {
+ test_id: result.test_id.clone(),
+ test_name: result.name.clone(),
+ classification,
+ reason: result
+ .failure_reason
+ .clone()
+ .unwrap_or_else(|| "Unknown failure".to_string()),
+ reproduction_steps: build_reproduction_steps(result),
+ });
}
}
for scenario in &scenario_results {
- if let Some(classification) = &scenario.failure_classification {
- if classification.is_blocking() {
- blocking_failures.push(BlockingFailure {
- test_id: scenario.scenario_id.clone(),
- test_name: scenario.scenario_name.clone(),
- classification: *classification,
- reason: scenario
- .failure_reason
- .clone()
- .unwrap_or_else(|| "Unknown failure".to_string()),
- reproduction_steps: vec![format!(
- "Run: cap-test compat-matrix --interactive (scenario: {})",
- scenario.scenario_name
- )],
- });
- }
+ if let Some(classification) = &scenario.failure_classification
+ && classification.is_blocking()
+ {
+ blocking_failures.push(BlockingFailure {
+ test_id: scenario.scenario_id.clone(),
+ test_name: scenario.scenario_name.clone(),
+ classification: *classification,
+ reason: scenario
+ .failure_reason
+ .clone()
+ .unwrap_or_else(|| "Unknown failure".to_string()),
+ reproduction_steps: vec![format!(
+ "Run: cap-test compat-matrix --interactive (scenario: {})",
+ scenario.scenario_name
+ )],
+ });
}
}
diff --git a/crates/cap-test/src/suites/scenarios.rs b/crates/cap-test/src/suites/scenarios.rs
index 65f3db109..940e16093 100644
--- a/crates/cap-test/src/suites/scenarios.rs
+++ b/crates/cap-test/src/suites/scenarios.rs
@@ -132,6 +132,7 @@ impl ScenarioRunner {
}
}
+ #[allow(clippy::too_many_arguments)]
async fn run_recording_scenario(
&self,
description: &str,
@@ -492,14 +493,14 @@ fn classify_scenario_result(
);
}
- if let Some(sync) = &validation.sync_info {
- if !sync.in_sync {
- return (
- TestStatus::Fail,
- Some(format!("A/V drift too high: {:.1}ms", sync.drift_ms)),
- Some(FailureClassification::PerformanceBelowThreshold),
- );
- }
+ if let Some(sync) = &validation.sync_info
+ && !sync.in_sync
+ {
+ return (
+ TestStatus::Fail,
+ Some(format!("A/V drift too high: {:.1}ms", sync.drift_ms)),
+ Some(FailureClassification::PerformanceBelowThreshold),
+ );
}
(TestStatus::Pass, None, None)
diff --git a/crates/cap-test/src/suites/validate.rs b/crates/cap-test/src/suites/validate.rs
index 6eaddc8ec..c07b0c741 100644
--- a/crates/cap-test/src/suites/validate.rs
+++ b/crates/cap-test/src/suites/validate.rs
@@ -115,14 +115,14 @@ fn validate_dash_display_dirs(
}
let m3u8_path = dir.join("media_0.m3u8");
- if m3u8_path.exists() {
- if let Ok(contents) = std::fs::read_to_string(&m3u8_path) {
- for line in contents.lines() {
- if let Some(duration_str) = line.strip_prefix("#EXTINF:") {
- let dur_str = duration_str.split(',').next().unwrap_or("");
- if let Ok(dur) = dur_str.parse::<f64>() {
- total_duration += dur;
- }
+ if m3u8_path.exists()
+ && let Ok(contents) = std::fs::read_to_string(&m3u8_path)
+ {
+ for line in contents.lines() {
+ if let Some(duration_str) = line.strip_prefix("#EXTINF:") {
+ let dur_str = duration_str.split(',').next().unwrap_or("");
+ if let Ok(dur) = dur_str.parse::<f64>() {
+ total_duration += dur;
}
}
}