From b1be9318bde52e93b833ef418bffcbdcb14e9d79 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Sat, 20 May 2017 15:46:57 +0200 Subject: [PATCH] simplify error handling --- src/codecs/indeo2.rs | 2 +- src/demuxers/avi.rs | 2 +- src/demuxers/mod.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) 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, -- 2.39.5