From cfa9ea2dc73125a570cb2a1df84e1fa8178fa4b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sun, 20 Oct 2024 17:40:00 +0300 Subject: [PATCH] analytics: Remove unnecessarily mutable references Part-of: --- gstreamer-analytics/src/classification.rs | 12 ++++++------ gstreamer-analytics/src/object_detection.rs | 12 ++++++------ gstreamer-analytics/src/relation_meta.rs | 4 ++-- gstreamer-analytics/src/tracking.rs | 4 ++-- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/gstreamer-analytics/src/classification.rs b/gstreamer-analytics/src/classification.rs index 43c8f81c7..7875bda70 100644 --- a/gstreamer-analytics/src/classification.rs +++ b/gstreamer-analytics/src/classification.rs @@ -95,8 +95,8 @@ impl<'a> AnalyticsMtdRef<'a, AnalyticsClassificationMtd> { #[doc(alias = "gst_analytics_cls_mtd_get_length")] pub fn len(&self) -> usize { unsafe { - let mut mtd = from(ffi::GstAnalyticsMtd::unsafe_from(self)); - ffi::gst_analytics_cls_mtd_get_length(&mut mtd) + let mtd = from(ffi::GstAnalyticsMtd::unsafe_from(self)); + ffi::gst_analytics_cls_mtd_get_length(&mtd) } } @@ -109,8 +109,8 @@ impl<'a> AnalyticsMtdRef<'a, AnalyticsClassificationMtd> { assert!(index < self.len()); unsafe { - let mut mtd = from(ffi::GstAnalyticsMtd::unsafe_from(self)); - ffi::gst_analytics_cls_mtd_get_level(&mut mtd, index) + let mtd = from(ffi::GstAnalyticsMtd::unsafe_from(self)); + ffi::gst_analytics_cls_mtd_get_level(&mtd, index) } } @@ -119,8 +119,8 @@ impl<'a> AnalyticsMtdRef<'a, AnalyticsClassificationMtd> { assert!(index < self.len()); unsafe { - let mut mtd = from(ffi::GstAnalyticsMtd::unsafe_from(self)); - from_glib(ffi::gst_analytics_cls_mtd_get_quark(&mut mtd, index)) + let mtd = from(ffi::GstAnalyticsMtd::unsafe_from(self)); + from_glib(ffi::gst_analytics_cls_mtd_get_quark(&mtd, index)) } } diff --git a/gstreamer-analytics/src/object_detection.rs b/gstreamer-analytics/src/object_detection.rs index 2fbcd5a7d..e20184b3c 100644 --- a/gstreamer-analytics/src/object_detection.rs +++ b/gstreamer-analytics/src/object_detection.rs @@ -84,8 +84,8 @@ impl<'a> AnalyticsMtdRef<'a, AnalyticsODMtd> { #[doc(alias = "gst_analytics_od_mtd_get_obj_type")] pub fn obj_type(&self) -> Option { unsafe { - let mut mtd = from(ffi::GstAnalyticsMtd::unsafe_from(self)); - let type_ = ffi::gst_analytics_od_mtd_get_obj_type(&mut mtd); + let mtd = from(ffi::GstAnalyticsMtd::unsafe_from(self)); + let type_ = ffi::gst_analytics_od_mtd_get_obj_type(&mtd); if type_ == 0 { None } else { @@ -99,9 +99,9 @@ impl<'a> AnalyticsMtdRef<'a, AnalyticsODMtd> { let mut loc = AnalyticsODLocation::default(); let success = unsafe { - let mut mtd = from(ffi::GstAnalyticsMtd::unsafe_from(self)); + let mtd = from(ffi::GstAnalyticsMtd::unsafe_from(self)); ffi::gst_analytics_od_mtd_get_location( - &mut mtd, + &mtd, &mut loc.x, &mut loc.y, &mut loc.w, @@ -120,9 +120,9 @@ impl<'a> AnalyticsMtdRef<'a, AnalyticsODMtd> { #[doc(alias = "gst_analytics_od_mtd_get_confidence_lvl")] pub fn confidence_level(&self) -> f32 { unsafe { - let mut mtd = from(ffi::GstAnalyticsMtd::unsafe_from(self)); + let mtd = from(ffi::GstAnalyticsMtd::unsafe_from(self)); let mut lvl: f32 = 0.0; - ffi::gst_analytics_od_mtd_get_confidence_lvl(&mut mtd, &mut lvl); + ffi::gst_analytics_od_mtd_get_confidence_lvl(&mtd, &mut lvl); lvl } } diff --git a/gstreamer-analytics/src/relation_meta.rs b/gstreamer-analytics/src/relation_meta.rs index 80c803c84..45d482a2a 100644 --- a/gstreamer-analytics/src/relation_meta.rs +++ b/gstreamer-analytics/src/relation_meta.rs @@ -282,8 +282,8 @@ impl<'a, T: AnalyticsMtd> AnalyticsMtdRef<'a, T> { #[doc(alias = "gst_analytics_mtd_get_mtd_type")] pub fn mtd_type(&self) -> ffi::GstAnalyticsMtdType { unsafe { - let mut mtd = ffi::GstAnalyticsMtd::unsafe_from(self); - ffi::gst_analytics_mtd_get_mtd_type(&mut mtd) + let mtd = ffi::GstAnalyticsMtd::unsafe_from(self); + ffi::gst_analytics_mtd_get_mtd_type(&mtd) } } } diff --git a/gstreamer-analytics/src/tracking.rs b/gstreamer-analytics/src/tracking.rs index a5388c1d9..1e7ee0faf 100644 --- a/gstreamer-analytics/src/tracking.rs +++ b/gstreamer-analytics/src/tracking.rs @@ -68,9 +68,9 @@ impl<'a> AnalyticsMtdRef<'a, AnalyticsTrackingMtd> { let mut tracking_lost: i32 = 0; unsafe { - let mut mtd = from(ffi::GstAnalyticsMtd::unsafe_from(self)); + let mtd = from(ffi::GstAnalyticsMtd::unsafe_from(self)); ffi::gst_analytics_tracking_mtd_get_info( - &mut mtd, + &mtd, &mut tracking_id, &mut tracking_first_seen, &mut tracking_last_seen,