gstreamer: Fix some new clippy warnings because of the MSRV bump

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1713>
This commit is contained in:
Sebastian Dröge 2025-04-14 11:13:58 +03:00
parent 187651b416
commit 8e475a9011
3 changed files with 10 additions and 10 deletions

View file

@ -221,7 +221,7 @@ impl BufferRef {
return Err(glib::bool_error!("Invalid range start"));
}
ops::Bound::Included(idx) => *idx,
ops::Bound::Excluded(idx) if idx.checked_add(1).map_or(true, |idx| idx >= n_memory) => {
ops::Bound::Excluded(idx) if idx.checked_add(1).is_none_or(|idx| idx >= n_memory) => {
return Err(glib::bool_error!("Invalid range start"));
}
ops::Bound::Excluded(idx) => *idx + 1,
@ -229,7 +229,7 @@ impl BufferRef {
};
let end_idx = match range.end_bound() {
ops::Bound::Included(idx) if idx.checked_add(1).map_or(true, |idx| idx > n_memory) => {
ops::Bound::Included(idx) if idx.checked_add(1).is_none_or(|idx| idx > n_memory) => {
return Err(glib::bool_error!("Invalid range end"));
}
ops::Bound::Included(idx) => *idx + 1,
@ -313,7 +313,7 @@ impl BufferRef {
return Err(glib::bool_error!("Invalid range start"));
}
ops::Bound::Included(idx) => *idx,
ops::Bound::Excluded(idx) if idx.checked_add(1).map_or(true, |idx| idx >= size) => {
ops::Bound::Excluded(idx) if idx.checked_add(1).is_none_or(|idx| idx >= size) => {
return Err(glib::bool_error!("Invalid range start"));
}
ops::Bound::Excluded(idx) => *idx + 1,
@ -321,7 +321,7 @@ impl BufferRef {
};
let end_idx = match range.end_bound() {
ops::Bound::Included(idx) if idx.checked_add(1).map_or(true, |idx| idx > size) => {
ops::Bound::Included(idx) if idx.checked_add(1).is_none_or(|idx| idx > size) => {
return Err(glib::bool_error!("Invalid range end"));
}
ops::Bound::Included(idx) => *idx + 1,
@ -1399,7 +1399,7 @@ impl Dump<'_> {
write!(f, "<start out of range>")?;
return Ok(());
}
Bound::Excluded(idx) if idx.checked_add(1).map_or(true, |idx| idx >= len) => {
Bound::Excluded(idx) if idx.checked_add(1).is_none_or(|idx| idx >= len) => {
write!(f, "<start out of range>")?;
return Ok(());
}
@ -1409,7 +1409,7 @@ impl Dump<'_> {
};
let end_idx = match self.end {
Bound::Included(idx) if idx.checked_add(1).map_or(true, |idx| idx > len) => {
Bound::Included(idx) if idx.checked_add(1).is_none_or(|idx| idx > len) => {
write!(f, "<end out of range>")?;
return Ok(());
}

View file

@ -2176,7 +2176,7 @@ impl<T: IsA<Pad> + IsA<glib::Object> + glib::object::IsClass> PadBuilder<T> {
Some("u") => {
if name_part
.get(conv_spec_start..)
.map_or(true, |s| s.parse::<u32>().is_err())
.is_none_or(|s| s.parse::<u32>().is_err())
{
crate::debug!(
CAT_RUST,
@ -2191,7 +2191,7 @@ impl<T: IsA<Pad> + IsA<glib::Object> + glib::object::IsClass> PadBuilder<T> {
Some("d") => {
if name_part
.get(conv_spec_start..)
.map_or(true, |s| s.parse::<i32>().is_err())
.is_none_or(|s| s.parse::<i32>().is_err())
{
crate::debug!(
CAT_RUST,

View file

@ -46,7 +46,7 @@ impl Dump<'_> {
write!(f, "<start out of range>")?;
return Ok(());
}
Bound::Excluded(idx) if idx.checked_add(1).map_or(true, |idx| idx >= len) => {
Bound::Excluded(idx) if idx.checked_add(1).is_none_or(|idx| idx >= len) => {
write!(f, "<start out of range>")?;
return Ok(());
}
@ -56,7 +56,7 @@ impl Dump<'_> {
};
let end_idx = match self.end {
Bound::Included(idx) if idx.checked_add(1).map_or(true, |idx| idx > len) => {
Bound::Included(idx) if idx.checked_add(1).is_none_or(|idx| idx > len) => {
write!(f, "<end out of range>")?;
return Ok(());
}