mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-22 01:21:05 +00:00
base: Fix all clippy::use_self warnings
This commit is contained in:
parent
980304ce36
commit
a36fe2a3f5
3 changed files with 14 additions and 17 deletions
|
@ -256,8 +256,8 @@ unsafe impl Send for UniqueAdapter {}
|
|||
unsafe impl Sync for UniqueAdapter {}
|
||||
|
||||
impl UniqueAdapter {
|
||||
pub fn new() -> UniqueAdapter {
|
||||
UniqueAdapter(Adapter::new())
|
||||
pub fn new() -> Self {
|
||||
Self(Adapter::new())
|
||||
}
|
||||
|
||||
pub fn available(&self) -> usize {
|
||||
|
|
|
@ -30,21 +30,21 @@ impl IntoGlib for Overhead {
|
|||
|
||||
fn into_glib(self) -> i32 {
|
||||
match self {
|
||||
Overhead::None => 0,
|
||||
Overhead::Frame => -1,
|
||||
Overhead::Bytes(b) => i32::try_from(b).expect("overhead is higher than i32::MAX"),
|
||||
Self::None => 0,
|
||||
Self::Frame => -1,
|
||||
Self::Bytes(b) => i32::try_from(b).expect("overhead is higher than i32::MAX"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl FromGlib<i32> for Overhead {
|
||||
#[inline]
|
||||
unsafe fn from_glib(val: i32) -> Overhead {
|
||||
unsafe fn from_glib(val: i32) -> Self {
|
||||
skip_assert_initialized!();
|
||||
match val {
|
||||
0 => Overhead::None,
|
||||
1 => Overhead::Frame,
|
||||
b if b > 0 => Overhead::Bytes(val as u32),
|
||||
0 => Self::None,
|
||||
1 => Self::Frame,
|
||||
b if b > 0 => Self::Bytes(val as u32),
|
||||
_ => panic!("overheader is lower than -1"),
|
||||
}
|
||||
}
|
||||
|
@ -78,13 +78,10 @@ impl<'a> fmt::Debug for BaseParseFrame<'a> {
|
|||
}
|
||||
|
||||
impl<'a> BaseParseFrame<'a> {
|
||||
pub(crate) unsafe fn new(
|
||||
frame: *mut ffi::GstBaseParseFrame,
|
||||
_parse: &'a BaseParse,
|
||||
) -> BaseParseFrame<'a> {
|
||||
pub(crate) unsafe fn new(frame: *mut ffi::GstBaseParseFrame, _parse: &'a BaseParse) -> Self {
|
||||
skip_assert_initialized!();
|
||||
assert!(!frame.is_null());
|
||||
BaseParseFrame(ptr::NonNull::new_unchecked(frame), PhantomData)
|
||||
Self(ptr::NonNull::new_unchecked(frame), PhantomData)
|
||||
}
|
||||
|
||||
pub fn buffer(&self) -> Option<&gst::BufferRef> {
|
||||
|
|
|
@ -31,7 +31,7 @@ glib::wrapper! {
|
|||
}
|
||||
|
||||
impl FlowCombiner {
|
||||
pub fn new() -> FlowCombiner {
|
||||
pub fn new() -> Self {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe { from_glib_full(ffi::gst_flow_combiner_new()) }
|
||||
}
|
||||
|
@ -104,8 +104,8 @@ unsafe impl Sync for UniqueFlowCombiner {}
|
|||
unsafe impl Send for UniqueFlowCombiner {}
|
||||
|
||||
impl UniqueFlowCombiner {
|
||||
pub fn new() -> UniqueFlowCombiner {
|
||||
UniqueFlowCombiner(FlowCombiner::new())
|
||||
pub fn new() -> Self {
|
||||
Self(FlowCombiner::new())
|
||||
}
|
||||
|
||||
pub fn add_pad<P: IsA<gst::Pad>>(&mut self, pad: &P) {
|
||||
|
|
Loading…
Reference in a new issue