Run everything to rustfmt again

This commit is contained in:
Sebastian Dröge 2017-12-01 19:02:53 +02:00
parent 0920008869
commit 411f54afed
11 changed files with 65 additions and 66 deletions

View file

@ -503,7 +503,9 @@ impl VideoInfo {
pub fn multiview_flags(&self) -> ::VideoMultiviewFlags { pub fn multiview_flags(&self) -> ::VideoMultiviewFlags {
unsafe { unsafe {
let ptr = &self.0._gst_reserved as *const _ as *const u32; let ptr = &self.0._gst_reserved as *const _ as *const u32;
from_glib(ffi::GstVideoMultiviewFlags::from_bits_truncate(ptr::read(ptr.offset(1)))) from_glib(ffi::GstVideoMultiviewFlags::from_bits_truncate(
ptr::read(ptr.offset(1)),
))
} }
} }

View file

@ -98,7 +98,9 @@ impl ToOwned for BufferListRef {
impl fmt::Debug for BufferListRef { impl fmt::Debug for BufferListRef {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let size = self.iter().map(|b| b.get_size()).sum::<usize>(); let size = self.iter().map(|b| b.get_size()).sum::<usize>();
let (pts, dts) = self.get(0).map(|b| (b.get_pts(), b.get_dts())).unwrap_or((::ClockTime::none(), ::ClockTime::none())); let (pts, dts) = self.get(0)
.map(|b| (b.get_pts(), b.get_dts()))
.unwrap_or((::ClockTime::none(), ::ClockTime::none()));
f.debug_struct("BufferList") f.debug_struct("BufferList")
.field("buffers", &self.len()) .field("buffers", &self.len())

View file

@ -345,9 +345,7 @@ define_iter!(IterMut, &'a mut CapsRef, &'a mut StructureRef);
impl fmt::Debug for CapsRef { impl fmt::Debug for CapsRef {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_tuple("Caps") f.debug_tuple("Caps").field(&self.to_string()).finish()
.field(&self.to_string())
.finish()
} }
} }

View file

@ -11,6 +11,10 @@ use std::fmt;
impl fmt::Display for DateTime { impl fmt::Display for DateTime {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str(self.to_iso8601_string().unwrap_or(String::from("None")).as_str()) f.write_str(
self.to_iso8601_string()
.unwrap_or(String::from("None"))
.as_str(),
)
} }
} }

View file

@ -376,7 +376,7 @@ impl glib::types::StaticType for EventRef {
impl fmt::Debug for EventRef { impl fmt::Debug for EventRef {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("Event") f.debug_struct("Event")
.field("type", & unsafe { .field("type", &unsafe {
let type_ = ffi::gst_event_type_get_name((*self.as_ptr()).type_); let type_ = ffi::gst_event_type_get_name((*self.as_ptr()).type_);
CStr::from_ptr(type_).to_str().unwrap() CStr::from_ptr(type_).to_str().unwrap()
}) })

View file

@ -316,17 +316,13 @@ impl GstRc<MessageRef> {
} }
#[cfg(any(feature = "v1_10", feature = "dox"))] #[cfg(any(feature = "v1_10", feature = "dox"))]
pub fn new_stream_collection( pub fn new_stream_collection(collection: &::StreamCollection) -> StreamCollectionBuilder {
collection: &::StreamCollection,
) -> StreamCollectionBuilder {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
StreamCollectionBuilder::new(collection) StreamCollectionBuilder::new(collection)
} }
#[cfg(any(feature = "v1_10", feature = "dox"))] #[cfg(any(feature = "v1_10", feature = "dox"))]
pub fn new_streams_selected( pub fn new_streams_selected(collection: &::StreamCollection) -> StreamsSelectedBuilder {
collection: &::StreamCollection,
) -> StreamsSelectedBuilder {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
StreamsSelectedBuilder::new(collection) StreamsSelectedBuilder::new(collection)
} }
@ -351,7 +347,7 @@ impl glib::types::StaticType for MessageRef {
impl fmt::Debug for MessageRef { impl fmt::Debug for MessageRef {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("Message") f.debug_struct("Message")
.field("type", & unsafe { .field("type", &unsafe {
let type_ = ffi::gst_message_type_get_name((*self.as_ptr()).type_); let type_ = ffi::gst_message_type_get_name((*self.as_ptr()).type_);
CStr::from_ptr(type_).to_str().unwrap() CStr::from_ptr(type_).to_str().unwrap()
}) })

View file

@ -165,8 +165,7 @@ pub trait PadExtManual {
fn set_getrange_function<F>(&self, func: F) fn set_getrange_function<F>(&self, func: F)
where where
F: Fn(&Pad, &Option<::Object>, u64, u32) F: Fn(&Pad, &Option<::Object>, u64, u32) -> Result<::Buffer, ::FlowReturn>
-> Result<::Buffer, ::FlowReturn>
+ Send + Send
+ Sync + Sync
+ 'static; + 'static;
@ -510,8 +509,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
fn set_getrange_function<F>(&self, func: F) fn set_getrange_function<F>(&self, func: F)
where where
F: Fn(&Pad, &Option<::Object>, u64, u32) F: Fn(&Pad, &Option<::Object>, u64, u32) -> Result<::Buffer, ::FlowReturn>
-> Result<::Buffer, ::FlowReturn>
+ Send + Send
+ Sync + Sync
+ 'static, + 'static,
@ -519,8 +517,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
unsafe { unsafe {
#[cfg_attr(feature = "cargo-clippy", allow(type_complexity))] #[cfg_attr(feature = "cargo-clippy", allow(type_complexity))]
let func_box: Box< let func_box: Box<
Fn(&Pad, &Option<::Object>, u64, u32) Fn(&Pad, &Option<::Object>, u64, u32) -> Result<::Buffer, ::FlowReturn>
-> Result<::Buffer, ::FlowReturn>
+ Send + Send
+ Sync + Sync
+ 'static, + 'static,
@ -925,8 +922,7 @@ unsafe extern "C" fn trampoline_getrange_function(
) -> ffi::GstFlowReturn { ) -> ffi::GstFlowReturn {
let _guard = CallbackGuard::new(); let _guard = CallbackGuard::new();
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))] #[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
let func: &&(Fn(&Pad, &Option<::Object>, u64, u32) let func: &&(Fn(&Pad, &Option<::Object>, u64, u32) -> Result<::Buffer, ::FlowReturn>
-> Result<::Buffer, ::FlowReturn>
+ Send + Send
+ Sync + Sync
+ 'static) = transmute((*pad).getrangedata); + 'static) = transmute((*pad).getrangedata);

View file

@ -186,7 +186,7 @@ impl glib::types::StaticType for QueryRef {
impl fmt::Debug for QueryRef { impl fmt::Debug for QueryRef {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("Query") f.debug_struct("Query")
.field("type", & unsafe { .field("type", &unsafe {
let type_ = ffi::gst_query_type_get_name((*self.as_ptr()).type_); let type_ = ffi::gst_query_type_get_name((*self.as_ptr()).type_);
CStr::from_ptr(type_).to_str().unwrap() CStr::from_ptr(type_).to_str().unwrap()
}) })

View file

@ -320,42 +320,41 @@ impl Clone for Segment {
impl fmt::Debug for Segment { impl fmt::Debug for Segment {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self.get_format() { match self.get_format() {
Format::Undefined => { Format::Undefined => f.debug_struct("Segment")
f.debug_struct("Segment") .field("format", &Format::Undefined)
.field("format", &Format::Undefined) .finish(),
.finish() Format::Time => f.debug_struct("Segment")
}, .field("format", &Format::Time)
Format::Time => { .field("start", &ClockTime::from(self.get_start()).to_string())
f.debug_struct("Segment") .field("offset", &ClockTime::from(self.get_offset()).to_string())
.field("format", &Format::Time) .field("stop", &ClockTime::from(self.get_stop()).to_string())
.field("start", &ClockTime::from(self.get_start()).to_string()) .field("rate", &self.get_rate())
.field("offset", &ClockTime::from(self.get_offset()).to_string()) .field("applied_rate", &self.get_applied_rate())
.field("stop", &ClockTime::from(self.get_stop()).to_string()) .field("flags", &self.get_flags())
.field("rate", &self.get_rate()) .field("time", &ClockTime::from(self.get_time()).to_string())
.field("applied_rate", &self.get_applied_rate()) .field("base", &ClockTime::from(self.get_base()).to_string())
.field("flags", &self.get_flags()) .field(
.field("time", &ClockTime::from(self.get_time()).to_string()) "position",
.field("base", &ClockTime::from(self.get_base()).to_string()) &ClockTime::from(self.get_position()).to_string(),
.field("position", &ClockTime::from(self.get_position()).to_string()) )
.field("duration", &ClockTime::from(self.get_duration()).to_string()) .field(
.finish() "duration",
}, &ClockTime::from(self.get_duration()).to_string(),
_ => { )
f.debug_struct("Segment") .finish(),
.field("format", &self.get_format()) _ => f.debug_struct("Segment")
.field("start", &self.get_start()) .field("format", &self.get_format())
.field("offset", &self.get_offset()) .field("start", &self.get_start())
.field("stop", &self.get_stop()) .field("offset", &self.get_offset())
.field("rate", &self.get_rate()) .field("stop", &self.get_stop())
.field("applied_rate", &self.get_applied_rate()) .field("rate", &self.get_rate())
.field("flags", &self.get_flags()) .field("applied_rate", &self.get_applied_rate())
.field("time", &self.get_time()) .field("flags", &self.get_flags())
.field("base", &self.get_base()) .field("time", &self.get_time())
.field("position", &self.get_position()) .field("base", &self.get_base())
.field("duration", &self.get_duration()) .field("position", &self.get_position())
.finish() .field("duration", &self.get_duration())
} .finish(),
} }
} }
} }

View file

@ -116,9 +116,7 @@ impl Drop for Structure {
impl fmt::Debug for Structure { impl fmt::Debug for Structure {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_tuple("Structure") f.debug_tuple("Structure").field(&self.to_string()).finish()
.field(&self.to_string())
.finish()
} }
} }

View file

@ -322,15 +322,19 @@ impl TagListRef {
} }
pub fn merge(&self, other: &TagListRef, mode: TagMergeMode) -> TagList { pub fn merge(&self, other: &TagListRef, mode: TagMergeMode) -> TagList {
unsafe { from_glib_full(ffi::gst_tag_list_merge(self.as_ptr(), other.as_ptr(), mode.to_glib())) } unsafe {
from_glib_full(ffi::gst_tag_list_merge(
self.as_ptr(),
other.as_ptr(),
mode.to_glib(),
))
}
} }
} }
impl fmt::Debug for TagListRef { impl fmt::Debug for TagListRef {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_tuple("TagList") f.debug_tuple("TagList").field(&self.to_string()).finish()
.field(&self.to_string())
.finish()
} }
} }