Commit c9423471 authored by Sebastian Dröge's avatar Sebastian Dröge 🍵
Browse files

Fix some clippy warnings in the examples

parent 7326377f
......@@ -12,7 +12,7 @@ use std::i32;
pub mod utils;
fn create_pipeline() -> Result<Pipeline, 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("audiotestsrc")?;
let sink = utils::create_element("appsink")?;
......
......@@ -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")?;
......
......@@ -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::Element, ExampleError> {
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> {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment