diff --git a/Cargo.toml b/Cargo.toml index 3ebcec3..024096d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,13 +6,13 @@ authors = ["Christopher N. Hesse "] edition = "2018" license = "MIT" readme = "README.md" -repository= "https://github.com/raymanfx/libv4l-rs" +repository = "https://github.com/raymanfx/libv4l-rs" [dependencies] bitflags = "2" libc = "0.2" v4l-sys = { path = "v4l-sys", version = "0.3.0", optional = true } -v4l2-sys = { path = "v4l2-sys", version = "0.3.0", package="v4l2-sys-mit", optional = true } +v4l2-sys = { path = "v4l2-sys", version = "0.3.0", package = "v4l2-sys-mit", optional = true } [dev-dependencies] glium = "0.34" @@ -25,7 +25,4 @@ libv4l = ["v4l-sys"] v4l2 = ["v4l2-sys"] [workspace] -members = [ - "v4l-sys", - "v4l2-sys", -] +members = ["v4l-sys", "v4l2-sys"] diff --git a/src/buffer.rs b/src/buffer.rs index 59a4c3e..37e1da8 100644 --- a/src/buffer.rs +++ b/src/buffer.rs @@ -26,6 +26,7 @@ pub enum Type { MetaOutput = 14, /// Deprecated, do not use + #[deprecated] Private = 0x80, } diff --git a/src/device.rs b/src/device.rs index 40fefde..d2cb575 100644 --- a/src/device.rs +++ b/src/device.rs @@ -156,9 +156,8 @@ impl Device { Err(e) => { if controls.is_empty() || e.kind() != io::ErrorKind::InvalidInput { return Err(e); - } else { - break; } + break; } } } @@ -250,9 +249,8 @@ impl Device { io::ErrorKind::InvalidInput, "All controls must be in the same class", )); - } else { - Some(c) } + Some(c) } None => Some(control.id & 0xFFFF0000), }; diff --git a/src/io/mmap/arena.rs b/src/io/mmap/arena.rs index 9fae806..17411ac 100644 --- a/src/io/mmap/arena.rs +++ b/src/io/mmap/arena.rs @@ -16,7 +16,7 @@ pub struct Arena<'a> { pub buf_type: buffer::Type, } -impl<'a> Arena<'a> { +impl Arena<'_> { /// Returns a new buffer manager instance /// /// You usually do not need to use this directly. @@ -118,7 +118,7 @@ impl<'a> Arena<'a> { } } -impl<'a> Drop for Arena<'a> { +impl Drop for Arena<'_> { fn drop(&mut self) { if self.bufs.is_empty() { // nothing to do diff --git a/src/io/mmap/stream.rs b/src/io/mmap/stream.rs index cd666bd..6db5d56 100644 --- a/src/io/mmap/stream.rs +++ b/src/io/mmap/stream.rs @@ -24,7 +24,7 @@ pub struct Stream<'a> { active: bool, } -impl<'a> Stream<'a> { +impl Stream<'_> { /// Returns a stream for frame capturing /// /// # Arguments @@ -89,7 +89,7 @@ impl<'a> Stream<'a> { } } -impl<'a> Drop for Stream<'a> { +impl Drop for Stream<'_> { fn drop(&mut self) { if let Err(e) = self.stop() { if let Some(code) = e.raw_os_error() { @@ -107,7 +107,7 @@ impl<'a> Drop for Stream<'a> { } } -impl<'a> StreamTrait for Stream<'a> { +impl StreamTrait for Stream<'_> { type Item = [u8]; fn start(&mut self) -> io::Result<()> { @@ -139,7 +139,7 @@ impl<'a> StreamTrait for Stream<'a> { } } -impl<'a, 'b> CaptureStream<'b> for Stream<'a> { +impl<'b> CaptureStream<'b> for Stream<'_> { fn queue(&mut self, index: usize) -> io::Result<()> { let mut v4l2_buf = v4l2_buffer { index: index as u32, @@ -209,7 +209,7 @@ impl<'a, 'b> CaptureStream<'b> for Stream<'a> { } } -impl<'a, 'b> OutputStream<'b> for Stream<'a> { +impl<'b> OutputStream<'b> for Stream<'_> { fn queue(&mut self, index: usize) -> io::Result<()> { let mut v4l2_buf = v4l2_buffer { index: index as u32, diff --git a/src/video/macros.rs b/src/video/macros.rs index 3f35829..5b9b3cd 100644 --- a/src/video/macros.rs +++ b/src/video/macros.rs @@ -27,9 +27,8 @@ macro_rules! impl_enum_frameintervals { if ret.is_err() { if v4l2_struct.index == 0 { return Err(ret.err().unwrap()); - } else { - return Ok(frameintervals); } + return Ok(frameintervals); } if let Ok(frame_interval) = FrameInterval::try_from(v4l2_struct) { @@ -64,9 +63,8 @@ macro_rules! impl_enum_framesizes { if ret.is_err() { if v4l2_struct.index == 0 { return Err(ret.err().unwrap()); - } else { - return Ok(framesizes); } + return Ok(framesizes); } if let Ok(frame_size) = FrameSize::try_from(v4l2_struct) {