Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix(clippy): collapse nested if into match guards for collapsible_match lint

Minit2dee7c0a46a5
diff --git a/crates/audio/src/latency.rs b/crates/audio/src/latency.rs
index 364c5d3fa..2a7804566 100644
--- a/crates/audio/src/latency.rs
+++ b/crates/audio/src/latency.rs
@@ -685,15 +685,13 @@ mod macos {
let mut latency_secs = total_frames as f64 / effective_rate;
match transport_kind {
- OutputTransportKind::Airplay => {
- if latency_secs < AIRPLAY_MIN_LATENCY_SECS {
- latency_secs = AIRPLAY_MIN_LATENCY_SECS;
- }
+ OutputTransportKind::Airplay if latency_secs < AIRPLAY_MIN_LATENCY_SECS => {
+ latency_secs = AIRPLAY_MIN_LATENCY_SECS;
}
- OutputTransportKind::Wireless | OutputTransportKind::ContinuityWireless => {
- if latency_secs < WIRELESS_MIN_LATENCY_SECS {
- latency_secs = WIRELESS_MIN_LATENCY_SECS;
- }
+ OutputTransportKind::Wireless | OutputTransportKind::ContinuityWireless
+ if latency_secs < WIRELESS_MIN_LATENCY_SECS =>
+ {
+ latency_secs = WIRELESS_MIN_LATENCY_SECS;
}
_ => {}
}
diff --git a/crates/rendering-skia/src/layers/background.rs b/crates/rendering-skia/src/layers/background.rs
index 90fd81b09..71e187695 100644
--- a/crates/rendering-skia/src/layers/background.rs
+++ b/crates/rendering-skia/src/layers/background.rs
@@ -277,31 +277,29 @@ impl RecordableLayer for BackgroundLayer {
// Handle image loading if needed
match &new_background {
- Background::Image { path } | Background::Wallpaper { path } => {
- if self.image_path.as_ref() != Some(path) || self.loaded_image.is_none() {
- // For now, we'll do synchronous loading. In a real implementation,
- // this should be async or cached at a higher level
- match std::fs::read(path) {
- Ok(image_data) => {
- let data = skia_safe::Data::new_copy(&image_data);
- if let Some(image) = Image::from_encoded(&data) {
- self.loaded_image = Some(image);
- self.image_path = Some(path.clone());
- } else {
- tracing::error!("Failed to decode image: {:?}", path);
- return Err(SkiaRenderingError::Other(anyhow::anyhow!(
- "Failed to decode image"
- )));
- }
- }
- Err(e) => {
- tracing::error!("Failed to load image: {:?}, error: {}", path, e);
+ Background::Image { path } | Background::Wallpaper { path }
+ if self.image_path.as_ref() != Some(path) || self.loaded_image.is_none() =>
+ {
+ match std::fs::read(path) {
+ Ok(image_data) => {
+ let data = skia_safe::Data::new_copy(&image_data);
+ if let Some(image) = Image::from_encoded(&data) {
+ self.loaded_image = Some(image);
+ self.image_path = Some(path.clone());
+ } else {
+ tracing::error!("Failed to decode image: {:?}", path);
return Err(SkiaRenderingError::Other(anyhow::anyhow!(
- "Failed to load image: {}",
- e
+ "Failed to decode image"
)));
}
}
+ Err(e) => {
+ tracing::error!("Failed to load image: {:?}, error: {}", path, e);
+ return Err(SkiaRenderingError::Other(anyhow::anyhow!(
+ "Failed to load image: {}",
+ e
+ )));
+ }
}
}
_ => {}