diff --git a/examples/src/bin/appsink.rs b/examples/src/bin/appsink.rs index f3ad11ac0..29794ddda 100644 --- a/examples/src/bin/appsink.rs +++ b/examples/src/bin/appsink.rs @@ -12,7 +12,7 @@ use std::i32; pub mod utils; fn create_pipeline() -> Result { - gst::init().map_err(|e| utils::ExampleError::InitFailed(e))?; + gst::init().map_err(utils::ExampleError::InitFailed)?; let pipeline = gst::Pipeline::new(None); let src = utils::create_element("audiotestsrc")?; let sink = utils::create_element("appsink")?; diff --git a/examples/src/bin/appsrc.rs b/examples/src/bin/appsrc.rs index 724954749..174f4665e 100644 --- a/examples/src/bin/appsrc.rs +++ b/examples/src/bin/appsrc.rs @@ -14,7 +14,7 @@ const WIDTH: usize = 320; const HEIGHT: usize = 240; fn create_pipeline() -> Result<(Pipeline, AppSrc), utils::ExampleError> { - gst::init().map_err(|e| utils::ExampleError::InitFailed(e))?; + gst::init().map_err(utils::ExampleError::InitFailed)?; let pipeline = gst::Pipeline::new(None); let src = utils::create_element("appsrc")?; diff --git a/examples/src/bin/utils/mod.rs b/examples/src/bin/utils/mod.rs index 6c1cb2007..6ea9e5a43 100644 --- a/examples/src/bin/utils/mod.rs +++ b/examples/src/bin/utils/mod.rs @@ -20,7 +20,7 @@ impl fmt::Display for ExampleError { ExampleError::InitFailed(ref e) => { write!(f, "GStreamer initialization failed: {:?}", e) } - ExampleError::ElementNotFound(ref e) => write!(f, "Element {} not found", e), + ExampleError::ElementNotFound(e) => write!(f, "Element {} not found", e), ExampleError::ElementLinkFailed(ref e1, ref e2) => { write!(f, "Link failed between {} and {}", e1, e2) } @@ -35,7 +35,7 @@ impl fmt::Display for ExampleError { } pub fn create_element(name: &'static str) -> Result { - gst::ElementFactory::make(name, None).ok_or(ExampleError::ElementNotFound(name)) + gst::ElementFactory::make(name, None).ok_or_else(|| ExampleError::ElementNotFound(name)) } pub fn link_elements(e1: &gst::Element, e2: &gst::Element) -> Result<(), ExampleError> {