From de41baba6062554a6504588b07e109761d98a366 Mon Sep 17 00:00:00 2001 From: "Christopher N. Hesse" Date: Sun, 14 Apr 2024 19:02:18 +0200 Subject: [PATCH] cargo fmt --all Signed-off-by: Christopher N. Hesse --- eye-hal/src/platform/v4l2/mod.rs | 1 - eye/src/colorconvert/codec/jpeg.rs | 10 +++++----- eye/src/colorconvert/codec/rgb.rs | 10 +++++----- eye/src/colorconvert/device.rs | 22 +++++++--------------- 4 files changed, 17 insertions(+), 26 deletions(-) diff --git a/eye-hal/src/platform/v4l2/mod.rs b/eye-hal/src/platform/v4l2/mod.rs index f6c3345..ceebe6d 100644 --- a/eye-hal/src/platform/v4l2/mod.rs +++ b/eye-hal/src/platform/v4l2/mod.rs @@ -9,7 +9,6 @@ pub mod context; pub mod device; pub mod stream; - use std::{convert::TryInto, str}; use crate::format::PixelFormat; diff --git a/eye/src/colorconvert/codec/jpeg.rs b/eye/src/colorconvert/codec/jpeg.rs index 7398517..20d0b58 100644 --- a/eye/src/colorconvert/codec/jpeg.rs +++ b/eye/src/colorconvert/codec/jpeg.rs @@ -8,11 +8,9 @@ pub fn blueprint() -> impl Blueprint { Builder::default() } -#[derive(Debug, Clone)] -#[derive(Default)] +#[derive(Debug, Clone, Default)] pub struct Builder {} - impl Blueprint for Builder { fn instantiate( &self, @@ -21,10 +19,12 @@ impl Blueprint for Builder { ) -> Result> { if !self .src_fmts() - .iter().any(|pixfmt| *pixfmt == inparams.pixfmt) + .iter() + .any(|pixfmt| *pixfmt == inparams.pixfmt) || !self .dst_fmts() - .iter().any(|pixfmt| *pixfmt == outparams.pixfmt) + .iter() + .any(|pixfmt| *pixfmt == outparams.pixfmt) { return Err(Error::from(ErrorKind::UnsupportedFormat)); } diff --git a/eye/src/colorconvert/codec/rgb.rs b/eye/src/colorconvert/codec/rgb.rs index 16d713f..b7d5c4a 100644 --- a/eye/src/colorconvert/codec/rgb.rs +++ b/eye/src/colorconvert/codec/rgb.rs @@ -11,11 +11,9 @@ pub fn blueprint() -> impl Blueprint { Builder::default() } -#[derive(Debug, Clone)] -#[derive(Default)] +#[derive(Debug, Clone, Default)] pub struct Builder {} - impl Blueprint for Builder { fn instantiate( &self, @@ -24,10 +22,12 @@ impl Blueprint for Builder { ) -> Result> { if !self .src_fmts() - .iter().any(|pixfmt| *pixfmt == inparams.pixfmt) + .iter() + .any(|pixfmt| *pixfmt == inparams.pixfmt) || !self .dst_fmts() - .iter().any(|pixfmt| *pixfmt == outparams.pixfmt) + .iter() + .any(|pixfmt| *pixfmt == outparams.pixfmt) { return Err(Error::from(ErrorKind::UnsupportedFormat)); } diff --git a/eye/src/colorconvert/device.rs b/eye/src/colorconvert/device.rs index 0c58a43..fabd222 100644 --- a/eye/src/colorconvert/device.rs +++ b/eye/src/colorconvert/device.rs @@ -40,11 +40,8 @@ impl<'a> DeviceTrait<'a> for Device<'a> { // now check which formats we can emulate for blueprint in codec::blueprints() { for chain in blueprint.src_fmts().iter().zip(blueprint.dst_fmts().iter()) { - if streams - .iter() - .any(|stream| stream.pixfmt == *chain.0) - && !streams - .iter().any(|stream| stream.pixfmt == *chain.1) + if streams.iter().any(|stream| stream.pixfmt == *chain.0) + && !streams.iter().any(|stream| stream.pixfmt == *chain.1) { // collect all streams with this pixfmt let _streams: Vec = streams @@ -86,11 +83,7 @@ impl<'a> DeviceTrait<'a> for Device<'a> { // find a supported format mapping let blueprints: Vec> = codec::blueprints() .into_iter() - .filter(|bp| { - bp.dst_fmts() - .iter() - .any(|pixfmt| *pixfmt == desc.pixfmt) - }) + .filter(|bp| bp.dst_fmts().iter().any(|pixfmt| *pixfmt == desc.pixfmt)) .collect(); let src_fmt = if let Some(pixfmt) = blueprints.iter().find_map(|bp| { for pixfmt in bp.src_fmts() { @@ -111,11 +104,10 @@ impl<'a> DeviceTrait<'a> for Device<'a> { }; // get the codec blueprint - let blueprint = if let Some(bp) = blueprints.into_iter().find(|bp| { - bp.src_fmts() - .into_iter() - .any(|pixfmt| pixfmt == src_fmt) - }) { + let blueprint = if let Some(bp) = blueprints + .into_iter() + .find(|bp| bp.src_fmts().into_iter().any(|pixfmt| pixfmt == src_fmt)) + { bp } else { return Err(Error::new(