mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-12-22 16:16:37 +00:00
Fix various clippy warnings
This commit is contained in:
parent
c4c8e738fd
commit
09db28bbf5
9 changed files with 18 additions and 18 deletions
|
@ -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> {
|
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(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 mut map_info: ffi::GstMapInfo = unsafe { mem::zeroed() };
|
||||||
let res: bool = unsafe {
|
let res: bool = unsafe {
|
||||||
from_glib(ffi::gst_buffer_map(
|
from_glib(ffi::gst_buffer_map(
|
||||||
buffer.as_mut_ptr(),
|
self.as_mut_ptr(),
|
||||||
&mut map_info,
|
&mut map_info,
|
||||||
ffi::GST_MAP_READ,
|
ffi::GST_MAP_READ,
|
||||||
))
|
))
|
||||||
};
|
};
|
||||||
if res {
|
if res {
|
||||||
Ok(ReadMappedBuffer {
|
Ok(ReadMappedBuffer {
|
||||||
buffer: buffer,
|
buffer: self,
|
||||||
map_info: map_info,
|
map_info: map_info,
|
||||||
})
|
})
|
||||||
} else {
|
} 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 mut map_info: ffi::GstMapInfo = unsafe { mem::zeroed() };
|
||||||
let res: bool = unsafe {
|
let res: bool = unsafe {
|
||||||
from_glib(ffi::gst_buffer_map(
|
from_glib(ffi::gst_buffer_map(
|
||||||
buffer.as_mut_ptr(),
|
self.as_mut_ptr(),
|
||||||
&mut map_info,
|
&mut map_info,
|
||||||
ffi::GST_MAP_READWRITE,
|
ffi::GST_MAP_READWRITE,
|
||||||
))
|
))
|
||||||
};
|
};
|
||||||
if res {
|
if res {
|
||||||
Ok(ReadWriteMappedBuffer {
|
Ok(ReadWriteMappedBuffer {
|
||||||
buffer: buffer,
|
buffer: self,
|
||||||
map_info: map_info,
|
map_info: map_info,
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
Err(buffer)
|
Err(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ impl BufferListRef {
|
||||||
unsafe { ffi::gst_buffer_list_length(self.as_mut_ptr()) as usize }
|
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)
|
Iter::new(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ unsafe extern "C" fn trampoline_sync(
|
||||||
func: gpointer,
|
func: gpointer,
|
||||||
) -> ffi::GstBusSyncReply {
|
) -> ffi::GstBusSyncReply {
|
||||||
let _guard = CallbackGuard::new();
|
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()
|
f(&from_glib_none(bus), &Message::from_glib_none(msg)).to_glib()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ impl str::FromStr for Caps {
|
||||||
|
|
||||||
impl CapsRef {
|
impl CapsRef {
|
||||||
pub fn set_simple(&mut self, values: &[(&str, &ToValue)]) {
|
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();
|
let value = value.to_value();
|
||||||
|
|
||||||
unsafe {
|
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 {
|
unsafe {
|
||||||
let structure = ffi::gst_caps_get_structure(self.as_ptr(), idx);
|
let structure = ffi::gst_caps_get_structure(self.as_ptr(), idx);
|
||||||
if structure.is_null() {
|
if structure.is_null() {
|
||||||
|
|
|
@ -31,7 +31,7 @@ impl Element {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Ok(());
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn unlink_many<E: IsA<Element>>(elements: &[&E]) {
|
pub fn unlink_many<E: IsA<Element>>(elements: &[&E]) {
|
||||||
|
|
|
@ -342,7 +342,7 @@ impl<'a> StreamStart<'a> {
|
||||||
if stream_id.is_null() {
|
if stream_id.is_null() {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
Some((CStr::from_ptr(stream_id).to_str().unwrap()))
|
Some(CStr::from_ptr(stream_id).to_str().unwrap())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1070,7 +1070,7 @@ impl<'a> Redirect<'a> {
|
||||||
|
|
||||||
macro_rules! message_builder_generic_impl {
|
macro_rules! message_builder_generic_impl {
|
||||||
($new_fn:expr) => {
|
($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 {
|
Self {
|
||||||
src: src.map(|o| {
|
src: src.map(|o| {
|
||||||
let o = (*o).clone();
|
let o = (*o).clone();
|
||||||
|
|
|
@ -254,7 +254,7 @@ unsafe extern "C" fn trampoline_pad_probe(
|
||||||
func: gpointer,
|
func: gpointer,
|
||||||
) -> ffi::GstPadProbeReturn {
|
) -> ffi::GstPadProbeReturn {
|
||||||
let _guard = CallbackGuard::new();
|
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);
|
transmute(func);
|
||||||
let mut data_type = None;
|
let mut data_type = None;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue