mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-10-31 22:59:14 +00:00
Fix some clippy warnings in the examples
This commit is contained in:
parent
7326377f5f
commit
c9423471b0
3 changed files with 4 additions and 4 deletions
|
@ -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> {
|
||||
|
|
Loading…
Reference in a new issue