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 {
unsafe {
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 {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
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")
.field("buffers", &self.len())

View file

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

View file

@ -11,6 +11,10 @@ use std::fmt;
impl fmt::Display for DateTime {
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 {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("Event")
.field("type", & unsafe {
.field("type", &unsafe {
let type_ = ffi::gst_event_type_get_name((*self.as_ptr()).type_);
CStr::from_ptr(type_).to_str().unwrap()
})

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -322,15 +322,19 @@ impl TagListRef {
}
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 {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_tuple("TagList")
.field(&self.to_string())
.finish()
f.debug_tuple("TagList").field(&self.to_string()).finish()
}
}