diff options
Diffstat (limited to 'matroska')
-rw-r--r-- | matroska/src/bin/mkvdump.rs | 4 | ||||
-rw-r--r-- | matroska/src/read.rs | 6 |
2 files changed, 5 insertions, 5 deletions
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<usize>) -> Result<String> { 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<u8> { } impl ReadValue for String { fn from_buf(buf: &[u8]) -> Result<Self> { - 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 { |