diff --git a/gst-plugin-file/src/filesink.rs b/gst-plugin-file/src/filesink.rs index 0fb264f5..a103ad8e 100644 --- a/gst-plugin-file/src/filesink.rs +++ b/gst-plugin-file/src/filesink.rs @@ -50,12 +50,10 @@ impl FileSink { } fn validate_uri(uri: &Url) -> Result<(), UriError> { - let _ = try!(uri.to_file_path().or_else(|_| { - Err(UriError::new( - gst::URIError::UnsupportedProtocol, - format!("Unsupported file URI '{}'", uri.as_str()), - )) - })); + let _ = try!(uri.to_file_path().or_else(|_| Err(UriError::new( + gst::URIError::UnsupportedProtocol, + format!("Unsupported file URI '{}'", uri.as_str()), + )))); Ok(()) } @@ -85,7 +83,6 @@ impl SinkImpl for FileSink { )) })); - let file = try!(File::create(location.as_path()).or_else(|err| { gst_error!( self.cat, @@ -131,9 +128,10 @@ impl SinkImpl for FileSink { ref mut position, } => (file, position), StreamingState::Stopped => { - return Err(FlowError::Error( - error_msg!(gst::LibraryError::Failed, ["Not started yet"]), - )); + return Err(FlowError::Error(error_msg!( + gst::LibraryError::Failed, + ["Not started yet"] + ))); } }; diff --git a/gst-plugin-file/src/filesrc.rs b/gst-plugin-file/src/filesrc.rs index 17bfad71..d139e23f 100644 --- a/gst-plugin-file/src/filesrc.rs +++ b/gst-plugin-file/src/filesrc.rs @@ -48,12 +48,10 @@ impl FileSrc { } fn validate_uri(uri: &Url) -> Result<(), UriError> { - let _ = try!(uri.to_file_path().or_else(|_| { - Err(UriError::new( - gst::URIError::UnsupportedProtocol, - format!("Unsupported file URI '{}'", uri.as_str()), - )) - })); + let _ = try!(uri.to_file_path().or_else(|_| Err(UriError::new( + gst::URIError::UnsupportedProtocol, + format!("Unsupported file URI '{}'", uri.as_str()), + )))); Ok(()) } @@ -144,9 +142,10 @@ impl SourceImpl for FileSrc { ref mut position, } => (file, position), StreamingState::Stopped => { - return Err(FlowError::Error( - error_msg!(gst::LibraryError::Failed, ["Not started yet"]), - )); + return Err(FlowError::Error(error_msg!( + gst::LibraryError::Failed, + ["Not started yet"] + ))); } }; diff --git a/gst-plugin-http/src/httpsrc.rs b/gst-plugin-http/src/httpsrc.rs index 405e4881..83ecc7c0 100644 --- a/gst-plugin-http/src/httpsrc.rs +++ b/gst-plugin-http/src/httpsrc.rs @@ -222,9 +222,10 @@ impl SourceImpl for HttpSrc { .. } => (response, position), StreamingState::Stopped => { - return Err(FlowError::Error( - error_msg!(gst::LibraryError::Failed, ["Not started yet"]), - )); + return Err(FlowError::Error(error_msg!( + gst::LibraryError::Failed, + ["Not started yet"] + ))); } }; diff --git a/gst-plugin-simple/src/sink.rs b/gst-plugin-simple/src/sink.rs index 4c102f80..db2e477c 100644 --- a/gst-plugin-simple/src/sink.rs +++ b/gst-plugin-simple/src/sink.rs @@ -122,12 +122,10 @@ impl Sink { uri_storage.0 = Some(uri); Ok(()) } - Err(err) => Err( - UriError::new( - gst::URIError::BadUri, - format!("Failed to parse URI '{}': {}", uri_str, err), - ).into_error(), - ), + Err(err) => Err(UriError::new( + gst::URIError::BadUri, + format!("Failed to parse URI '{}': {}", uri_str, err), + ).into_error()), } } else { Ok(()) diff --git a/gst-plugin-simple/src/source.rs b/gst-plugin-simple/src/source.rs index facfffca..26c6ee0a 100644 --- a/gst-plugin-simple/src/source.rs +++ b/gst-plugin-simple/src/source.rs @@ -136,12 +136,10 @@ impl Source { uri_storage.0 = Some(uri); Ok(()) } - Err(err) => Err( - UriError::new( - gst::URIError::BadUri, - format!("Failed to parse URI '{}': {}", uri_str, err), - ).into_error(), - ), + Err(err) => Err(UriError::new( + gst::URIError::BadUri, + format!("Failed to parse URI '{}': {}", uri_str, err), + ).into_error()), } } else { Ok(()) diff --git a/gst-plugin-togglerecord/tests/tests.rs b/gst-plugin-togglerecord/tests/tests.rs index b08d618b..3cee1c26 100644 --- a/gst-plugin-togglerecord/tests/tests.rs +++ b/gst-plugin-togglerecord/tests/tests.rs @@ -202,10 +202,7 @@ fn recv_buffers( while let Ok(val) = receiver_output.recv() { match val { Left(buffer) => { - res.push(( - segment.to_running_time(buffer.get_pts()), - buffer.get_pts(), - )); + res.push((segment.to_running_time(buffer.get_pts()), buffer.get_pts())); n_buffers += 1; if wait_buffers > 0 && n_buffers == wait_buffers { return res; diff --git a/gst-plugin/src/base_sink.rs b/gst-plugin/src/base_sink.rs index 3565767f..7df41471 100644 --- a/gst-plugin/src/base_sink.rs +++ b/gst-plugin/src/base_sink.rs @@ -306,7 +306,9 @@ where let wrap: T = from_glib_borrow(ptr as *mut InstanceStruct); let imp = &*element.imp; - panic_to_error!(&wrap, &element.panicked, false, { imp.start(&wrap) }).to_glib() + panic_to_error!(&wrap, &element.panicked, false, { + imp.start(&wrap) + }).to_glib() } unsafe extern "C" fn base_sink_stop( @@ -321,7 +323,9 @@ where let wrap: T = from_glib_borrow(ptr as *mut InstanceStruct); let imp = &*element.imp; - panic_to_error!(&wrap, &element.panicked, false, { imp.stop(&wrap) }).to_glib() + panic_to_error!(&wrap, &element.panicked, false, { + imp.stop(&wrap) + }).to_glib() } unsafe extern "C" fn base_sink_render( @@ -455,12 +459,9 @@ where Some(gst::CapsRef::from_ptr(filter)) }; - panic_to_error!( - &wrap, - &element.panicked, - None, - { imp.get_caps(&wrap, filter) } - ).map(|caps| caps.into_ptr()) + panic_to_error!(&wrap, &element.panicked, None, { + imp.get_caps(&wrap, filter) + }).map(|caps| caps.into_ptr()) .unwrap_or(ptr::null_mut()) } @@ -478,12 +479,9 @@ where let imp = &*element.imp; let caps = gst::CapsRef::from_ptr(caps); - panic_to_error!( - &wrap, - &element.panicked, - false, - { imp.set_caps(&wrap, caps) } - ).to_glib() + panic_to_error!(&wrap, &element.panicked, false, { + imp.set_caps(&wrap, caps) + }).to_glib() } unsafe extern "C" fn base_sink_fixate( @@ -517,7 +515,9 @@ where let wrap: T = from_glib_borrow(ptr as *mut InstanceStruct); let imp = &*element.imp; - panic_to_error!(&wrap, &element.panicked, false, { imp.unlock(&wrap) }).to_glib() + panic_to_error!(&wrap, &element.panicked, false, { + imp.unlock(&wrap) + }).to_glib() } unsafe extern "C" fn base_sink_unlock_stop( @@ -532,5 +532,7 @@ where let wrap: T = from_glib_borrow(ptr as *mut InstanceStruct); let imp = &*element.imp; - panic_to_error!(&wrap, &element.panicked, false, { imp.unlock_stop(&wrap) }).to_glib() + panic_to_error!(&wrap, &element.panicked, false, { + imp.unlock_stop(&wrap) + }).to_glib() } diff --git a/gst-plugin/src/base_src.rs b/gst-plugin/src/base_src.rs index 9ca9ca99..55b44e16 100644 --- a/gst-plugin/src/base_src.rs +++ b/gst-plugin/src/base_src.rs @@ -129,9 +129,7 @@ pub unsafe trait BaseSrcBase let parent_klass = (*klass).get_parent_class() as *const gst_base_ffi::GstBaseSrcClass; (*parent_klass) .do_seek - .map(|f| { - from_glib(f(self.to_glib_none().0, segment.to_glib_none_mut().0)) - }) + .map(|f| from_glib(f(self.to_glib_none().0, segment.to_glib_none_mut().0))) .unwrap_or(false) } } @@ -153,9 +151,7 @@ pub unsafe trait BaseSrcBase let parent_klass = (*klass).get_parent_class() as *const gst_base_ffi::GstBaseSrcClass; (*parent_klass) .event - .map(|f| { - from_glib(f(self.to_glib_none().0, event.to_glib_none().0)) - }) + .map(|f| from_glib(f(self.to_glib_none().0, event.to_glib_none().0))) .unwrap_or(false) } } @@ -381,7 +377,9 @@ where let wrap: T = from_glib_borrow(ptr as *mut InstanceStruct); let imp = &*element.imp; - panic_to_error!(&wrap, &element.panicked, false, { imp.start(&wrap) }).to_glib() + panic_to_error!(&wrap, &element.panicked, false, { + imp.start(&wrap) + }).to_glib() } unsafe extern "C" fn base_src_stop( @@ -396,7 +394,9 @@ where let wrap: T = from_glib_borrow(ptr as *mut InstanceStruct); let imp = &*element.imp; - panic_to_error!(&wrap, &element.panicked, false, { imp.stop(&wrap) }).to_glib() + panic_to_error!(&wrap, &element.panicked, false, { + imp.stop(&wrap) + }).to_glib() } unsafe extern "C" fn base_src_is_seekable( @@ -411,7 +411,9 @@ where let wrap: T = from_glib_borrow(ptr as *mut InstanceStruct); let imp = &*element.imp; - panic_to_error!(&wrap, &element.panicked, false, { imp.is_seekable(&wrap) }).to_glib() + panic_to_error!(&wrap, &element.panicked, false, { + imp.is_seekable(&wrap) + }).to_glib() } unsafe extern "C" fn base_src_get_size( @@ -561,12 +563,9 @@ where Some(gst::CapsRef::from_ptr(filter)) }; - panic_to_error!( - &wrap, - &element.panicked, - None, - { imp.get_caps(&wrap, filter) } - ).map(|caps| caps.into_ptr()) + panic_to_error!(&wrap, &element.panicked, None, { + imp.get_caps(&wrap, filter) + }).map(|caps| caps.into_ptr()) .unwrap_or(ptr::null_mut()) } @@ -582,7 +581,9 @@ where let wrap: T = from_glib_borrow(ptr as *mut InstanceStruct); let imp = &*element.imp; - panic_to_error!(&wrap, &element.panicked, false, { imp.negotiate(&wrap) }).to_glib() + panic_to_error!(&wrap, &element.panicked, false, { + imp.negotiate(&wrap) + }).to_glib() } unsafe extern "C" fn base_src_set_caps( @@ -599,12 +600,9 @@ where let imp = &*element.imp; let caps = gst::CapsRef::from_ptr(caps); - panic_to_error!( - &wrap, - &element.panicked, - false, - { imp.set_caps(&wrap, caps) } - ).to_glib() + panic_to_error!(&wrap, &element.panicked, false, { + imp.set_caps(&wrap, caps) + }).to_glib() } unsafe extern "C" fn base_src_fixate( @@ -638,7 +636,9 @@ where let wrap: T = from_glib_borrow(ptr as *mut InstanceStruct); let imp = &*element.imp; - panic_to_error!(&wrap, &element.panicked, false, { imp.unlock(&wrap) }).to_glib() + panic_to_error!(&wrap, &element.panicked, false, { + imp.unlock(&wrap) + }).to_glib() } unsafe extern "C" fn base_src_unlock_stop( @@ -653,5 +653,7 @@ where let wrap: T = from_glib_borrow(ptr as *mut InstanceStruct); let imp = &*element.imp; - panic_to_error!(&wrap, &element.panicked, false, { imp.unlock_stop(&wrap) }).to_glib() + panic_to_error!(&wrap, &element.panicked, false, { + imp.unlock_stop(&wrap) + }).to_glib() } diff --git a/gst-plugin/src/base_transform.rs b/gst-plugin/src/base_transform.rs index 017b32df..3af3d91b 100644 --- a/gst-plugin/src/base_transform.rs +++ b/gst-plugin/src/base_transform.rs @@ -425,7 +425,9 @@ where let wrap: T = from_glib_borrow(ptr as *mut InstanceStruct); let imp = &*element.imp; - panic_to_error!(&wrap, &element.panicked, false, { imp.start(&wrap) }).to_glib() + panic_to_error!(&wrap, &element.panicked, false, { + imp.start(&wrap) + }).to_glib() } unsafe extern "C" fn base_transform_stop( @@ -440,7 +442,9 @@ where let wrap: T = from_glib_borrow(ptr as *mut InstanceStruct); let imp = &*element.imp; - panic_to_error!(&wrap, &element.panicked, false, { imp.stop(&wrap) }).to_glib() + panic_to_error!(&wrap, &element.panicked, false, { + imp.stop(&wrap) + }).to_glib() } unsafe extern "C" fn base_transform_transform_caps( @@ -465,7 +469,6 @@ where Some(from_glib_borrow(filter)) }; - imp.transform_caps( &wrap, from_glib(direction), diff --git a/gst-plugin/src/bin.rs b/gst-plugin/src/bin.rs index 4def3c1f..e8462105 100644 --- a/gst-plugin/src/bin.rs +++ b/gst-plugin/src/bin.rs @@ -46,9 +46,7 @@ pub unsafe trait BinBase: IsA + IsA + ObjectType { let parent_klass = (*klass).get_parent_class() as *const gst_ffi::GstBinClass; (*parent_klass) .add_element - .map(|f| { - from_glib(f(self.to_glib_none().0, element.to_glib_none().0)) - }) + .map(|f| from_glib(f(self.to_glib_none().0, element.to_glib_none().0))) .unwrap_or(false) } } @@ -59,9 +57,7 @@ pub unsafe trait BinBase: IsA + IsA + ObjectType { let parent_klass = (*klass).get_parent_class() as *const gst_ffi::GstBinClass; (*parent_klass) .remove_element - .map(|f| { - from_glib(f(self.to_glib_none().0, element.to_glib_none().0)) - }) + .map(|f| from_glib(f(self.to_glib_none().0, element.to_glib_none().0))) .unwrap_or(false) } } diff --git a/gst-plugin/src/element.rs b/gst-plugin/src/element.rs index 1e0b957b..87592a44 100644 --- a/gst-plugin/src/element.rs +++ b/gst-plugin/src/element.rs @@ -63,9 +63,7 @@ pub unsafe trait ElementBase: IsA + ObjectType { let parent_klass = (*klass).get_parent_class() as *const gst_ffi::GstElementClass; (*parent_klass) .change_state - .map(|f| { - from_glib(f(self.to_glib_none().0, transition.to_glib())) - }) + .map(|f| from_glib(f(self.to_glib_none().0, transition.to_glib()))) .unwrap_or(gst::StateChangeReturn::Success) } } @@ -346,7 +344,9 @@ where let imp = &*element.imp; let query = gst::QueryRef::from_mut_ptr(query); - panic_to_error!(&wrap, &element.panicked, false, { imp.query(&wrap, query) }).to_glib() + panic_to_error!(&wrap, &element.panicked, false, { + imp.query(&wrap, query) + }).to_glib() } unsafe extern "C" fn element_set_context(