Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

clippy

Richie McIlroyfa3592def7d5
diff --git a/crates/camera-ffmpeg/src/windows.rs b/crates/camera-ffmpeg/src/windows.rs
index f03d2868f..939b041a5 100644
--- a/crates/camera-ffmpeg/src/windows.rs
+++ b/crates/camera-ffmpeg/src/windows.rs
@@ -103,12 +103,12 @@ impl H264Decoder {
}
pub fn flush(&mut self) -> Result<Vec<FFVideo>, AsFFmpegError> {
- if let Err(e) = self.decoder.send_eof() {
- if !matches!(e, ffmpeg::Error::Eof) {
- return Err(AsFFmpegError::H264DecodeError(format!(
- "Failed to send EOF: {e}"
- )));
- }
+ if let Err(e) = self.decoder.send_eof()
+ && !matches!(e, ffmpeg::Error::Eof)
+ {
+ return Err(AsFFmpegError::H264DecodeError(format!(
+ "Failed to send EOF: {e}"
+ )));
}
self.drain_frames()?;
diff --git a/crates/gpu-converters/src/yuyv.rs b/crates/gpu-converters/src/yuyv.rs
index 045acf57a..5040d980f 100644
--- a/crates/gpu-converters/src/yuyv.rs
+++ b/crates/gpu-converters/src/yuyv.rs
@@ -13,7 +13,7 @@ pub fn create_input_texture(
if height == 0 {
return Err("YUYV texture height must be non-zero".to_string());
}
- if width % 2 != 0 {
+ if !width.is_multiple_of(2) {
return Err(format!(
"YUYV texture width must be even (got {width}), as YUYV encodes pairs of pixels"
));
diff --git a/crates/gpu-converters/src/yuyv_nv12/mod.rs b/crates/gpu-converters/src/yuyv_nv12/mod.rs
index a82f19cb1..cbe1cc54b 100644
--- a/crates/gpu-converters/src/yuyv_nv12/mod.rs
+++ b/crates/gpu-converters/src/yuyv_nv12/mod.rs
@@ -107,7 +107,7 @@ impl YUYVToNV12 {
width: u32,
height: u32,
) -> Result<(Vec<u8>, Vec<u8>), ConvertError> {
- if width % 2 != 0 {
+ if !width.is_multiple_of(2) {
return Err(ConvertError::OddWidth { width });
}
diff --git a/crates/gpu-converters/src/yuyv_rgba/mod.rs b/crates/gpu-converters/src/yuyv_rgba/mod.rs
index dc989bf55..b3b0d7ae7 100644
--- a/crates/gpu-converters/src/yuyv_rgba/mod.rs
+++ b/crates/gpu-converters/src/yuyv_rgba/mod.rs
@@ -89,7 +89,7 @@ impl YUYVToRGBA {
width: u32,
height: u32,
) -> Result<Vec<u8>, ConvertError> {
- if width % 2 != 0 {
+ if !width.is_multiple_of(2) {
return Err(ConvertError::OddWidth { width });
}