From 05d11426a8e60fa060733eb8ae7843bc2ae9725c Mon Sep 17 00:00:00 2001 From: metamuffin Date: Mon, 10 Jun 2024 15:28:36 +0200 Subject: apply many clippy issue --- matroska/src/bin/mkvdump.rs | 4 ++-- matroska/src/read.rs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'matroska') diff --git a/matroska/src/bin/mkvdump.rs b/matroska/src/bin/mkvdump.rs index b58adcc..c40e325 100644 --- a/matroska/src/bin/mkvdump.rs +++ b/matroska/src/bin/mkvdump.rs @@ -9,9 +9,9 @@ use std::{fs::File, io::BufReader}; fn main() { env_logger::init_from_env("LOG"); let path = std::env::args().nth(1).unwrap(); - let mut r = EbmlReader::new(BufReader::new(File::open(path).unwrap())); + let r = EbmlReader::new(BufReader::new(File::open(path).unwrap())); - while let Some(tag) = r.next() { + for tag in r { let (position, tag) = tag.unwrap(); match tag { MatroskaTag::SimpleBlock(b) | MatroskaTag::Block(b) => { diff --git a/matroska/src/read.rs b/matroska/src/read.rs index 536f2f8..42fbd73 100644 --- a/matroska/src/read.rs +++ b/matroska/src/read.rs @@ -83,7 +83,7 @@ impl EbmlReader { #[inline] pub fn read_utf8(&mut self, size: impl Into) -> Result { let b = self.read_buf(size)?; - Ok(String::from_utf8(b).map_err(|_| Error::InvalidUTF8)?) + String::from_utf8(b).map_err(|_| Error::InvalidUTF8) } #[inline] @@ -160,7 +160,7 @@ impl EbmlReader { ); self.queue.clear(); self.position = position; - self.inner.seek(SeekFrom::Start(position as u64))?; + self.inner.seek(SeekFrom::Start(position))?; self.stack = path .iter() .map(|id| StackTag { id: *id, end: None }) @@ -257,7 +257,7 @@ impl ReadValue for Vec { } impl ReadValue for String { fn from_buf(buf: &[u8]) -> Result { - Ok(String::from_utf8(Vec::from(buf)).map_err(|_| Error::InvalidUTF8)?) + String::from_utf8(Vec::from(buf)).map_err(|_| Error::InvalidUTF8) } } impl ReadValue for Master { -- cgit v1.2.3-70-g09d2