Fix various new 1.73 clippy warnings

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1317>
This commit is contained in:
Sebastian Dröge 2023-10-03 17:44:12 +03:00
parent 7bde0285ff
commit a6470f13c9
8 changed files with 12 additions and 11 deletions

View file

@ -160,7 +160,7 @@ impl AudioConverterConfig {
})
.collect::<Vec<_>>()
})
.unwrap_or_else(Vec::new)
.unwrap_or_default()
}
#[cfg(feature = "v1_22")]

View file

@ -148,13 +148,14 @@ impl str::FromStr for crate::AudioFormat {
}
impl PartialOrd for crate::AudioFormat {
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
crate::AudioFormatInfo::from_format(*self)
.partial_cmp(&crate::AudioFormatInfo::from_format(*other))
Some(self.cmp(other))
}
}
impl Ord for crate::AudioFormat {
#[inline]
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
crate::AudioFormatInfo::from_format(*self).cmp(&crate::AudioFormatInfo::from_format(*other))
}

View file

@ -305,13 +305,14 @@ impl str::FromStr for crate::VideoFormat {
}
impl PartialOrd for crate::VideoFormat {
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
crate::VideoFormatInfo::from_format(*self)
.partial_cmp(&crate::VideoFormatInfo::from_format(*other))
Some(self.cmp(other))
}
}
impl Ord for crate::VideoFormat {
#[inline]
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
crate::VideoFormatInfo::from_format(*self).cmp(&crate::VideoFormatInfo::from_format(*other))
}

View file

@ -461,7 +461,7 @@ impl Eq for ValidVideoTimeCode {}
impl PartialOrd for ValidVideoTimeCode {
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {
self.compare(other).partial_cmp(&0)
Some(self.cmp(other))
}
}

View file

@ -483,7 +483,7 @@ impl Eq for crate::TypeFindProbability {}
impl PartialOrd for crate::TypeFindProbability {
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {
(self.into_glib() as u32).partial_cmp(&(other.into_glib() as u32))
Some(self.cmp(other))
}
}
@ -542,7 +542,7 @@ impl Eq for crate::Rank {}
impl PartialOrd for crate::Rank {
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {
(self.into_glib() as u32).partial_cmp(&(other.into_glib() as u32))
Some(self.cmp(other))
}
}

View file

@ -2047,7 +2047,6 @@ mod tests {
{
let buffers = buffers.clone();
let flow_override = flow_override;
pad.add_probe(crate::PadProbeType::BUFFER, move |_, info| {
if let Some(PadProbeData::Buffer(buffer)) = info.data.take() {
let mut buffers = buffers.lock().unwrap();

View file

@ -215,7 +215,7 @@ impl Eq for TaskPoolFunction {}
impl PartialOrd for TaskPoolFunction {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
self.as_ptr().partial_cmp(&other.as_ptr())
Some(self.cmp(other))
}
}

View file

@ -80,7 +80,7 @@ impl<F: FnMut(&Task) + Send + 'static> TaskBuilder<F> {
(*func_ptr).1 = task.to_glib_none().0;
let lock = self.lock.unwrap_or_else(TaskLock::new);
let lock = self.lock.unwrap_or_default();
ffi::gst_task_set_lock(task.to_glib_none().0, mut_override(&lock.0 .0));
task.set_data("gstreamer-rs-task-lock", Arc::clone(&lock.0));