Fix various clippy warnings

This commit is contained in:
Sebastian Dröge 2017-08-02 19:40:31 +03:00
parent c4c8e738fd
commit 09db28bbf5
9 changed files with 18 additions and 18 deletions

View file

@ -32,7 +32,7 @@ impl<O: IsA<Bin>> BinExtManual for O {
}
}
return Ok(());
Ok(())
}
fn remove_many<E: IsA<Element>>(&self, elements: &[&E]) -> Result<(), glib::BoolError> {
@ -48,6 +48,6 @@ impl<O: IsA<Bin>> BinExtManual for O {
}
}
return Ok(());
Ok(())
}
}

View file

@ -108,41 +108,41 @@ impl GstRc<BufferRef> {
}
}
pub fn into_read_mapped_buffer(buffer: Self) -> Result<ReadMappedBuffer, Self> {
pub fn into_read_mapped_buffer(self) -> Result<ReadMappedBuffer, Self> {
let mut map_info: ffi::GstMapInfo = unsafe { mem::zeroed() };
let res: bool = unsafe {
from_glib(ffi::gst_buffer_map(
buffer.as_mut_ptr(),
self.as_mut_ptr(),
&mut map_info,
ffi::GST_MAP_READ,
))
};
if res {
Ok(ReadMappedBuffer {
buffer: buffer,
buffer: self,
map_info: map_info,
})
} else {
Err(buffer)
Err(self)
}
}
pub fn into_readwrite_mapped_buffer(buffer: Self) -> Result<ReadWriteMappedBuffer, Self> {
pub fn into_readwrite_mapped_buffer(self) -> Result<ReadWriteMappedBuffer, Self> {
let mut map_info: ffi::GstMapInfo = unsafe { mem::zeroed() };
let res: bool = unsafe {
from_glib(ffi::gst_buffer_map(
buffer.as_mut_ptr(),
self.as_mut_ptr(),
&mut map_info,
ffi::GST_MAP_READWRITE,
))
};
if res {
Ok(ReadWriteMappedBuffer {
buffer: buffer,
buffer: self,
map_info: map_info,
})
} else {
Err(buffer)
Err(self)
}
}

View file

@ -68,7 +68,7 @@ impl BufferListRef {
unsafe { ffi::gst_buffer_list_length(self.as_mut_ptr()) as usize }
}
pub fn iter<'a>(&'a self) -> Iter<'a> {
pub fn iter(&self) -> Iter {
Iter::new(self)
}
}

View file

@ -47,7 +47,7 @@ unsafe extern "C" fn trampoline_sync(
func: gpointer,
) -> ffi::GstBusSyncReply {
let _guard = CallbackGuard::new();
let f: &Box<Fn(&Bus, &Message) -> BusSyncReply + 'static> = transmute(func);
let f: &&(Fn(&Bus, &Message) -> BusSyncReply + 'static) = transmute(func);
f(&from_glib_none(bus), &Message::from_glib_none(msg)).to_glib()
}

View file

@ -105,7 +105,7 @@ impl str::FromStr for Caps {
impl CapsRef {
pub fn set_simple(&mut self, values: &[(&str, &ToValue)]) {
for &(name, ref value) in values {
for &(name, value) in values {
let value = value.to_value();
unsafe {
@ -135,7 +135,7 @@ impl CapsRef {
}
}
pub fn get_mut_structure<'a>(&'a mut self, idx: u32) -> Option<&'a mut StructureRef> {
pub fn get_mut_structure(&mut self, idx: u32) -> Option<&mut StructureRef> {
unsafe {
let structure = ffi::gst_caps_get_structure(self.as_ptr(), idx);
if structure.is_null() {

View file

@ -31,7 +31,7 @@ impl Element {
}
}
return Ok(());
Ok(())
}
pub fn unlink_many<E: IsA<Element>>(elements: &[&E]) {

View file

@ -342,7 +342,7 @@ impl<'a> StreamStart<'a> {
if stream_id.is_null() {
None
} else {
Some((CStr::from_ptr(stream_id).to_str().unwrap()))
Some(CStr::from_ptr(stream_id).to_str().unwrap())
}
}
}

View file

@ -1070,7 +1070,7 @@ impl<'a> Redirect<'a> {
macro_rules! message_builder_generic_impl {
($new_fn:expr) => {
pub fn src<'b, T: IsA<Object> + Cast + Clone>(self, src: Option<&'b T>) -> Self {
pub fn src<T: IsA<Object> + Cast + Clone>(self, src: Option<&T>) -> Self {
Self {
src: src.map(|o| {
let o = (*o).clone();

View file

@ -254,7 +254,7 @@ unsafe extern "C" fn trampoline_pad_probe(
func: gpointer,
) -> ffi::GstPadProbeReturn {
let _guard = CallbackGuard::new();
let func: &Box<Fn(&Pad, &mut PadProbeInfo) -> PadProbeReturn + Send + Sync + 'static> =
let func: &&(Fn(&Pad, &mut PadProbeInfo) -> PadProbeReturn + Send + Sync + 'static) =
transmute(func);
let mut data_type = None;