From aa3cc48756daaf6ca978dded6f63987df3d65579 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 5 May 2021 11:51:42 +0300 Subject: [PATCH] Fix new 1.52 clippy warnings --- gstreamer-rtp/src/rtp_buffer.rs | 10 ++++------ gstreamer/src/structure.rs | 6 +----- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/gstreamer-rtp/src/rtp_buffer.rs b/gstreamer-rtp/src/rtp_buffer.rs index 563ffd63e..0cbabf77a 100644 --- a/gstreamer-rtp/src/rtp_buffer.rs +++ b/gstreamer-rtp/src/rtp_buffer.rs @@ -1,6 +1,6 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::translate::{from_glib, from_glib_full, FromGlibPtrFull, IntoGlib}; +use glib::translate::{from_glib, FromGlibPtrFull, IntoGlib}; use std::fmt; use std::marker::PhantomData; use std::mem; @@ -266,13 +266,11 @@ impl<'a, T> RTPBuffer<'a, T> { pub fn extension_bytes(&self) -> Option<(u16, glib::Bytes)> { unsafe { let mut bits: u16 = 0; - match from_glib_full(ffi::gst_rtp_buffer_get_extension_bytes( + Option::::from_glib_full(ffi::gst_rtp_buffer_get_extension_bytes( glib::translate::mut_override(&self.rtp_buffer), &mut bits, - )) { - Some(bytes) => Some((bits, bytes)), - None => None, - } + )) + .map(|bytes| (bits, bytes)) } } diff --git a/gstreamer/src/structure.rs b/gstreamer/src/structure.rs index 47b4c4cdf..3c422d4ba 100644 --- a/gstreamer/src/structure.rs +++ b/gstreamer/src/structure.rs @@ -756,11 +756,7 @@ impl<'a> DoubleEndedIterator for FieldIterator<'a> { } self.n_fields -= 1; - if let Some(field_name) = self.structure.nth_field_name(self.n_fields) { - Some(field_name) - } else { - None - } + self.structure.nth_field_name(self.n_fields) } }