Run everything through rustfmt again

This commit is contained in:
Sebastian Dröge 2017-12-20 19:30:32 +02:00
parent 8e1428c047
commit cbfb30c7b5
11 changed files with 85 additions and 91 deletions

View file

@ -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"]
)));
}
};

View file

@ -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"]
)));
}
};

View file

@ -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"]
)));
}
};

View file

@ -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(())

View file

@ -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(())

View file

@ -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;

View file

@ -306,7 +306,9 @@ where
let wrap: T = from_glib_borrow(ptr as *mut InstanceStruct<T>);
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<T: BaseSinkBase>(
@ -321,7 +323,9 @@ where
let wrap: T = from_glib_borrow(ptr as *mut InstanceStruct<T>);
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<T: BaseSinkBase>(
@ -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<T: BaseSinkBase>(
@ -517,7 +515,9 @@ where
let wrap: T = from_glib_borrow(ptr as *mut InstanceStruct<T>);
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<T: BaseSinkBase>(
@ -532,5 +532,7 @@ where
let wrap: T = from_glib_borrow(ptr as *mut InstanceStruct<T>);
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()
}

View file

@ -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<T>);
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<T: BaseSrcBase>(
@ -396,7 +394,9 @@ where
let wrap: T = from_glib_borrow(ptr as *mut InstanceStruct<T>);
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<T: BaseSrcBase>(
@ -411,7 +411,9 @@ where
let wrap: T = from_glib_borrow(ptr as *mut InstanceStruct<T>);
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<T: BaseSrcBase>(
@ -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<T>);
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<T: BaseSrcBase>(
@ -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<T: BaseSrcBase>(
@ -638,7 +636,9 @@ where
let wrap: T = from_glib_borrow(ptr as *mut InstanceStruct<T>);
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<T: BaseSrcBase>(
@ -653,5 +653,7 @@ where
let wrap: T = from_glib_borrow(ptr as *mut InstanceStruct<T>);
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()
}

View file

@ -425,7 +425,9 @@ where
let wrap: T = from_glib_borrow(ptr as *mut InstanceStruct<T>);
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<T: BaseTransformBase>(
@ -440,7 +442,9 @@ where
let wrap: T = from_glib_borrow(ptr as *mut InstanceStruct<T>);
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<T: BaseTransformBase>(
@ -465,7 +469,6 @@ where
Some(from_glib_borrow(filter))
};
imp.transform_caps(
&wrap,
from_glib(direction),

View file

@ -46,9 +46,7 @@ pub unsafe trait BinBase: IsA<gst::Element> + IsA<gst::Bin> + 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<gst::Element> + IsA<gst::Bin> + 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)
}
}

View file

@ -63,9 +63,7 @@ pub unsafe trait ElementBase: IsA<gst::Element> + 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<T: ElementBase>(