Use Option::is_some_and(...) instead of Option::map_or(false, ...)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1466>
This commit is contained in:
Sebastian Dröge 2024-06-19 11:04:25 +03:00
parent 84ea10dc73
commit 45ec7cedd9
3 changed files with 4 additions and 6 deletions

View file

@ -79,9 +79,7 @@ pub fn codec_utils_aac_caps_set_level_and_profile(
let s = caps.structure(0).unwrap();
assert_eq!(s.name(), "audio/mpeg");
assert!(s
.get::<i32>("mpegversion")
.map_or(false, |v| v == 2 || v == 4));
assert!(s.get::<i32>("mpegversion").is_ok_and(|v| v == 2 || v == 4));
let len = audio_config.len() as u32;
unsafe {
@ -199,7 +197,7 @@ pub fn codec_utils_mpeg4video_caps_set_level_and_profile(
let s = caps.structure(0).unwrap();
assert_eq!(s.name(), "video/mpeg");
assert!(s.get::<i32>("mpegversion").map_or(false, |v| v == 4));
assert!(s.get::<i32>("mpegversion").is_ok_and(|v| v == 4));
let len = vis_obj_seq.len() as u32;
unsafe {

View file

@ -236,7 +236,7 @@ impl EventRef {
#[doc(alias = "gst_event_has_name")]
#[inline]
pub fn has_name(&self, name: &str) -> bool {
self.structure().map_or(false, |s| s.has_name(name))
self.structure().is_some_and(|s| s.has_name(name))
}
pub fn view(&self) -> EventView {

View file

@ -119,7 +119,7 @@ impl MessageRef {
#[doc(alias = "gst_message_has_name")]
#[inline]
pub fn has_name(&self, name: &str) -> bool {
self.structure().map_or(false, |s| s.has_name(name))
self.structure().is_some_and(|s| s.has_name(name))
}
pub fn view(&self) -> MessageView {