Mark GMutex mutex guards as #[must_use]

See gstreamer-rs commit b21f5764309f9f65666016a9069e1b938935e6f2
This commit is contained in:
Sebastian Dröge 2020-04-08 15:24:07 +03:00
parent 7173790da2
commit 4206b53c09
3 changed files with 3 additions and 1 deletions

View file

@ -85,6 +85,7 @@ pub fn set_element_flags<T: glib::IsA<gst::Object> + glib::IsA<gst::Element>>(
}
}
#[must_use = "if unused the Mutex will immediately unlock"]
struct MutexGuard<'a>(&'a glib_ffi::GMutex);
impl<'a> MutexGuard<'a> {

View file

@ -21,7 +21,7 @@ impl<O: IsA<AggregatorPad>> AggregatorPadExtManual for O {
fn get_segment(&self) -> gst::Segment {
unsafe {
let ptr: &gst_base_sys::GstAggregatorPad = &*(self.as_ptr() as *const _);
super::utils::MutexGuard::lock(&ptr.parent.object.lock);
let _guard = super::utils::MutexGuard::lock(&ptr.parent.object.lock);
from_glib_none(&ptr.segment as *const gst_sys::GstSegment)
}
}

View file

@ -9,6 +9,7 @@
use glib::translate::mut_override;
use glib_sys;
#[must_use = "if unused the Mutex will immediately unlock"]
pub struct MutexGuard<'a>(&'a glib_sys::GMutex);
impl<'a> MutexGuard<'a> {