From: Kostya Shishkov Date: Sat, 20 May 2017 13:46:57 +0000 (+0200) Subject: simplify error handling X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=b1be9318bde52e93b833ef418bffcbdcb14e9d79;p=nihav.git simplify error handling --- diff --git a/src/codecs/indeo2.rs b/src/codecs/indeo2.rs index fec0f12..3914309 100644 --- a/src/codecs/indeo2.rs +++ b/src/codecs/indeo2.rs @@ -394,7 +394,7 @@ mod test { loop { let pktres = dmx.get_frame(); if let Err(e) = pktres { - if (e as i32) == (DemuxerError::EOF as i32) { break; } + if e == DemuxerError::EOF { break; } panic!("error"); } let pkt = pktres.unwrap(); diff --git a/src/demuxers/avi.rs b/src/demuxers/avi.rs index 8737fbf..5a55ff7 100644 --- a/src/demuxers/avi.rs +++ b/src/demuxers/avi.rs @@ -383,7 +383,7 @@ mod test { loop { let pktres = dmx.get_frame(); if let Err(e) = pktres { - if (e as i32) == (DemuxerError::EOF as i32) { break; } + if e == DemuxerError::EOF { break; } panic!("error"); } let pkt = pktres.unwrap(); diff --git a/src/demuxers/mod.rs b/src/demuxers/mod.rs index d4d70a2..ac7ae38 100644 --- a/src/demuxers/mod.rs +++ b/src/demuxers/mod.rs @@ -7,7 +7,7 @@ use std::rc::Rc; use frame::*; use io::byteio::*; -#[derive(Debug)] +#[derive(Debug,Clone,Copy,PartialEq)] #[allow(dead_code)] pub enum DemuxerError { EOF,