diff --git a/gstreamer-audio/src/audio_format.rs b/gstreamer-audio/src/audio_format.rs index 8d296fee0..3cbb83b54 100644 --- a/gstreamer-audio/src/audio_format.rs +++ b/gstreamer-audio/src/audio_format.rs @@ -138,14 +138,12 @@ impl crate::AudioFormat { impl str::FromStr for crate::AudioFormat { type Err = glib::BoolError; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> Result { assert_initialized_main_thread!(); unsafe { - let fmt = crate::AudioFormat::from_glib(ffi::gst_audio_format_from_string( - s.to_glib_none().0, - )); - if fmt == crate::AudioFormat::Unknown { + let fmt = Self::from_glib(ffi::gst_audio_format_from_string(s.to_glib_none().0)); + if fmt == Self::Unknown { Err(glib::glib_bool_error!( "Failed to parse audio format from string" )) diff --git a/gstreamer-audio/src/audio_format_info.rs b/gstreamer-audio/src/audio_format_info.rs index 1ea4d68d7..fa958263d 100644 --- a/gstreamer-audio/src/audio_format_info.rs +++ b/gstreamer-audio/src/audio_format_info.rs @@ -292,10 +292,10 @@ impl fmt::Display for AudioFormatInfo { impl str::FromStr for crate::AudioFormatInfo { type Err = glib::BoolError; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> Result { skip_assert_initialized!(); let format = s.parse()?; - Ok(AudioFormatInfo::from_format(format)) + Ok(Self::from_format(format)) } } diff --git a/gstreamer-video/src/video_format.rs b/gstreamer-video/src/video_format.rs index 4b34b7483..a6f976856 100644 --- a/gstreamer-video/src/video_format.rs +++ b/gstreamer-video/src/video_format.rs @@ -339,15 +339,13 @@ impl crate::VideoFormat { impl str::FromStr for crate::VideoFormat { type Err = glib::BoolError; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> Result { assert_initialized_main_thread!(); unsafe { - let fmt = crate::VideoFormat::from_glib(ffi::gst_video_format_from_string( - s.to_glib_none().0, - )); + let fmt = Self::from_glib(ffi::gst_video_format_from_string(s.to_glib_none().0)); - if fmt == crate::VideoFormat::Unknown { + if fmt == Self::Unknown { Err(glib::glib_bool_error!( "Failed to parse video format from string" )) diff --git a/gstreamer-video/src/video_format_info.rs b/gstreamer-video/src/video_format_info.rs index 33de36d69..29d94f826 100644 --- a/gstreamer-video/src/video_format_info.rs +++ b/gstreamer-video/src/video_format_info.rs @@ -431,10 +431,10 @@ impl fmt::Display for VideoFormatInfo { impl str::FromStr for crate::VideoFormatInfo { type Err = glib::BoolError; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> Result { skip_assert_initialized!(); let format = s.parse()?; - Ok(VideoFormatInfo::from_format(format)) + Ok(Self::from_format(format)) } } diff --git a/gstreamer-video/src/video_info.rs b/gstreamer-video/src/video_info.rs index c7e2a9f40..bff87a301 100644 --- a/gstreamer-video/src/video_info.rs +++ b/gstreamer-video/src/video_info.rs @@ -139,7 +139,7 @@ impl Eq for VideoColorimetry {} impl str::FromStr for crate::VideoColorimetry { type Err = glib::error::BoolError; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> Result { assert_initialized_main_thread!(); unsafe { @@ -149,7 +149,7 @@ impl str::FromStr for crate::VideoColorimetry { s.to_glib_none().0, )); if valid { - Ok(VideoColorimetry(colorimetry.assume_init())) + Ok(Self(colorimetry.assume_init())) } else { Err(glib::glib_bool_error!("Invalid colorimetry info")) } @@ -179,12 +179,13 @@ impl fmt::Display for crate::VideoColorimetry { impl str::FromStr for crate::VideoChromaSite { type Err = glib::error::BoolError; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> Result { assert_initialized_main_thread!(); unsafe { - let chroma_site = from_glib(ffi::gst_video_chroma_from_string(s.to_glib_none().0)); - if chroma_site == crate::VideoChromaSite::empty() { + let chroma_site: Self = + from_glib(ffi::gst_video_chroma_from_string(s.to_glib_none().0)); + if chroma_site.is_empty() { Err(glib::glib_bool_error!("Invalid chroma site")) } else { Ok(chroma_site) @@ -1034,7 +1035,7 @@ impl crate::VideoFieldOrder { impl str::FromStr for crate::VideoFieldOrder { type Err = glib::error::BoolError; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> Result { assert_initialized_main_thread!(); unsafe { @@ -1066,7 +1067,7 @@ impl crate::VideoInterlaceMode { impl str::FromStr for crate::VideoInterlaceMode { type Err = glib::error::BoolError; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> Result { assert_initialized_main_thread!(); unsafe { diff --git a/gstreamer-video/src/video_time_code.rs b/gstreamer-video/src/video_time_code.rs index 59028dbce..deffb6f92 100644 --- a/gstreamer-video/src/video_time_code.rs +++ b/gstreamer-video/src/video_time_code.rs @@ -475,10 +475,10 @@ generic_impl!(ValidVideoTimeCode); impl str::FromStr for VideoTimeCode { type Err = glib::error::BoolError; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> Result { assert_initialized_main_thread!(); unsafe { - Option::::from_glib_full(ffi::gst_video_time_code_new_from_string( + Option::::from_glib_full(ffi::gst_video_time_code_new_from_string( s.to_glib_none().0, )) .ok_or_else(|| glib::glib_bool_error!("Failed to create VideoTimeCode from string")) diff --git a/gstreamer-video/src/video_time_code_interval.rs b/gstreamer-video/src/video_time_code_interval.rs index 12dbd5525..059ad645e 100644 --- a/gstreamer-video/src/video_time_code_interval.rs +++ b/gstreamer-video/src/video_time_code_interval.rs @@ -120,12 +120,12 @@ impl fmt::Display for VideoTimeCodeInterval { impl str::FromStr for VideoTimeCodeInterval { type Err = glib::error::BoolError; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> Result { assert_initialized_main_thread!(); unsafe { - Option::::from_glib_full( - ffi::gst_video_time_code_interval_new_from_string(s.to_glib_none().0), - ) + Option::::from_glib_full(ffi::gst_video_time_code_interval_new_from_string( + s.to_glib_none().0, + )) .ok_or_else(|| { glib::glib_bool_error!("Failed to create VideoTimeCodeInterval from string") }) diff --git a/gstreamer/src/caps.rs b/gstreamer/src/caps.rs index d13bebe18..0c45ebd01 100644 --- a/gstreamer/src/caps.rs +++ b/gstreamer/src/caps.rs @@ -161,7 +161,7 @@ impl Caps { impl str::FromStr for Caps { type Err = glib::BoolError; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> Result { assert_initialized_main_thread!(); unsafe { Option::<_>::from_glib_full(ffi::gst_caps_from_string(s.to_glib_none().0)) diff --git a/gstreamer/src/caps_features.rs b/gstreamer/src/caps_features.rs index 9d626f617..2e30862a5 100644 --- a/gstreamer/src/caps_features.rs +++ b/gstreamer/src/caps_features.rs @@ -123,7 +123,7 @@ impl fmt::Display for CapsFeatures { impl str::FromStr for CapsFeatures { type Err = glib::BoolError; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> Result { assert_initialized_main_thread!(); unsafe { let ptr = ffi::gst_caps_features_from_string(s.to_glib_none().0); @@ -133,7 +133,7 @@ impl str::FromStr for CapsFeatures { )); } - Ok(CapsFeatures(ptr::NonNull::new_unchecked( + Ok(Self(ptr::NonNull::new_unchecked( ptr as *mut CapsFeaturesRef, ))) } diff --git a/gstreamer/src/structure.rs b/gstreamer/src/structure.rs index 2ad749073..225e3eb7e 100644 --- a/gstreamer/src/structure.rs +++ b/gstreamer/src/structure.rs @@ -181,7 +181,7 @@ impl Eq for Structure {} impl str::FromStr for Structure { type Err = glib::BoolError; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> Result { assert_initialized_main_thread!(); unsafe { let structure = ffi::gst_structure_from_string(s.to_glib_none().0, ptr::null_mut()); @@ -190,7 +190,7 @@ impl str::FromStr for Structure { "Failed to parse structure from string" )) } else { - Ok(Structure(ptr::NonNull::new_unchecked( + Ok(Self(ptr::NonNull::new_unchecked( structure as *mut StructureRef, ))) }