From 1eef842a714c72b8ccb7889aef6bba26fb9fcf2b Mon Sep 17 00:00:00 2001 From: Patrick Crumley Date: Tue, 10 Dec 2024 16:55:26 -0800 Subject: [PATCH] fix new rust lints (#1467) # Description @swift-nav/algint-team -- maybe fixes new rust lints # API compatibility Does this change introduce a API compatibility risk? ## API compatibility plan If the above is "Yes", please detail the compatibility (or migration) plan: # JIRA Reference https://swift-nav.atlassian.net/browse/BOARD-XXXX --- .../sbpg/targets/resources/rust/sbp_messages_template.rs | 5 +++-- rust/sbp/src/link.rs | 6 +++--- rust/sbp/src/messages/file_io.rs | 1 - rust/sbp/src/messages/flash.rs | 2 -- rust/sbp/src/messages/navigation.rs | 1 - rust/sbp/src/messages/solution_meta.rs | 8 ++++---- rust/sbp/src/messages/ssr.rs | 9 --------- rust/sbp/src/sbp_iter_ext.rs | 2 +- rust/sbp/src/sbp_string.rs | 4 ++-- 9 files changed, 13 insertions(+), 25 deletions(-) diff --git a/generator/sbpg/targets/resources/rust/sbp_messages_template.rs b/generator/sbpg/targets/resources/rust/sbp_messages_template.rs index ac9a8d4ec0..1798c41b07 100644 --- a/generator/sbpg/targets/resources/rust/sbp_messages_template.rs +++ b/generator/sbpg/targets/resources/rust/sbp_messages_template.rs @@ -33,8 +33,9 @@ use crate::messages::(((i)))::*; ((*- endfor *)) ((*- if m.desc *)) - -/// (((m.short_desc))) +((* if m.short_desc *)) +/// (((m.short_desc | commentify))) +((*- endif *)) /// /// (((m.desc | commentify))) /// diff --git a/rust/sbp/src/link.rs b/rust/sbp/src/link.rs index a83689d050..c8c6e9edfb 100644 --- a/rust/sbp/src/link.rs +++ b/rust/sbp/src/link.rs @@ -68,7 +68,7 @@ where } } -impl<'link> LinkSource<'link, ()> { +impl LinkSource<'_, ()> { /// Send a message to all the links associated with this source. pub fn send(&self, msg: M) -> bool where @@ -129,7 +129,7 @@ impl<'link, S> Link<'link, S> { } } -impl<'link, S> Clone for Link<'link, S> { +impl Clone for Link<'_, S> { fn clone(&self) -> Self { Self { inner: Arc::clone(&self.inner), @@ -148,7 +148,7 @@ pub struct Handler<'link, S> { msg_types: Cow<'static, [u16]>, } -impl<'link, S> Handler<'link, S> { +impl Handler<'_, S> { fn run(&mut self, state: &S, msg: Sbp) { (self.func)(state, msg); } diff --git a/rust/sbp/src/messages/file_io.rs b/rust/sbp/src/messages/file_io.rs index ff1f79590c..fc2eaddbbe 100644 --- a/rust/sbp/src/messages/file_io.rs +++ b/rust/sbp/src/messages/file_io.rs @@ -124,7 +124,6 @@ pub mod msg_fileio_config_resp { use crate::messages::lib::*; /// Response with advice on the optimal configuration for FileIO. - /// /// The advice on the optimal configuration for a FileIO transfer. Newer /// version of FileIO can support greater throughput by supporting a large diff --git a/rust/sbp/src/messages/flash.rs b/rust/sbp/src/messages/flash.rs index 4ae5bc0873..991391137b 100644 --- a/rust/sbp/src/messages/flash.rs +++ b/rust/sbp/src/messages/flash.rs @@ -1033,7 +1033,6 @@ pub mod msg_stm_unique_id_req { use crate::messages::lib::*; /// Read device's hard-coded unique ID request (host => device) - /// /// This message reads the device's hard-coded unique ID. The host requests /// the ID by sending a MSG_STM_UNIQUE_ID_REQ. The device responds with a @@ -1112,7 +1111,6 @@ pub mod msg_stm_unique_id_resp { use crate::messages::lib::*; /// Read device's hard-coded unique ID response (host <= device) - /// /// This message reads the device's hard-coded unique ID. The host requests /// the ID by sending a MSG_STM_UNIQUE_ID_REQ. The device responds with a diff --git a/rust/sbp/src/messages/navigation.rs b/rust/sbp/src/messages/navigation.rs index c18cde1b03..466ee8e264 100644 --- a/rust/sbp/src/messages/navigation.rs +++ b/rust/sbp/src/messages/navigation.rs @@ -6984,7 +6984,6 @@ pub mod msg_utc_leap_second { use crate::messages::lib::*; /// Leap second SBP message. - /// /// UTC-GPST leap seconds before and after the most recent (past, or future, /// for announced insertions) UTC leap second insertion. diff --git a/rust/sbp/src/messages/solution_meta.rs b/rust/sbp/src/messages/solution_meta.rs index 0da5890ddb..9861e3744a 100644 --- a/rust/sbp/src/messages/solution_meta.rs +++ b/rust/sbp/src/messages/solution_meta.rs @@ -119,8 +119,8 @@ pub mod imu_input_type { use super::*; use crate::messages::lib::*; - /// Provides detail about the IMU sensor, its timestamping mode, and its quality for input to the fuzed solution - + /// Provides detail about the IMU sensor, its timestamping mode, and its + /// quality for input to the fuzed solution /// /// Metadata around the IMU sensors involved in the fuzed solution. Accessible /// through sol_in\[N\].flags in a MSG_SOLN_META. @@ -755,8 +755,8 @@ pub mod odo_input_type { use super::*; use crate::messages::lib::*; - /// Provides detail about the Odometry sensor, its timestamping mode, and its quality for input to the fuzed solution - + /// Provides detail about the Odometry sensor, its timestamping mode, and its + /// quality for input to the fuzed solution /// /// Metadata around the Odometry sensors involved in the fuzed solution. /// Accessible through sol_in\[N\].flags in a MSG_SOLN_META. diff --git a/rust/sbp/src/messages/ssr.rs b/rust/sbp/src/messages/ssr.rs index 979de0192f..d79d81787b 100644 --- a/rust/sbp/src/messages/ssr.rs +++ b/rust/sbp/src/messages/ssr.rs @@ -2671,7 +2671,6 @@ pub mod msg_ssr_tile_definition { use crate::messages::lib::*; /// Definition of a SSR atmospheric correction tile. - /// /// Provides the correction point coordinates for the atmospheric correction /// values in the MSG_SSR_STEC_CORRECTION and MSG_SSR_GRIDDED_CORRECTION @@ -3242,7 +3241,6 @@ pub mod orbit_clock_bound { use crate::messages::gnss::*; use crate::messages::lib::*; - /// None /// /// Orbit and clock bound. /// @@ -3335,7 +3333,6 @@ pub mod orbit_clock_bound_degradation { use crate::messages::gnss::*; use crate::messages::lib::*; - /// None /// /// Orbit and clock bound degradation. /// @@ -3637,7 +3634,6 @@ pub mod stec_residual { use crate::messages::gnss::*; use crate::messages::lib::*; - /// None /// /// STEC residual (mean and standard deviation) for the given satellite at the /// grid point. @@ -3689,7 +3685,6 @@ pub mod stec_residual_no_std { use crate::messages::gnss::*; use crate::messages::lib::*; - /// None /// /// STEC residual for the given satellite at the grid point. /// @@ -3730,7 +3725,6 @@ pub mod stec_sat_element { use crate::messages::gnss::*; use crate::messages::lib::*; - /// None /// /// STEC polynomial for the given satellite. /// @@ -3782,7 +3776,6 @@ pub mod stec_sat_element_integrity { use crate::messages::gnss::*; use crate::messages::lib::*; - /// None /// /// STEC polynomial and bounds for the given satellite. /// @@ -4075,7 +4068,6 @@ pub mod tropospheric_delay_correction { use crate::messages::gnss::*; use crate::messages::lib::*; - /// None /// /// Troposphere vertical delays (mean and standard deviation) at the grid /// point. @@ -4127,7 +4119,6 @@ pub mod tropospheric_delay_correction_no_std { use crate::messages::gnss::*; use crate::messages::lib::*; - /// None /// /// Troposphere vertical delays at the grid point. /// diff --git a/rust/sbp/src/sbp_iter_ext.rs b/rust/sbp/src/sbp_iter_ext.rs index 0db26ba646..e87af0d1c7 100644 --- a/rust/sbp/src/sbp_iter_ext.rs +++ b/rust/sbp/src/sbp_iter_ext.rs @@ -94,7 +94,7 @@ where } } -impl<'a, I, E> Iterator for HandleErrorsIter<'a, I, E> +impl Iterator for HandleErrorsIter<'_, I, E> where I: Iterator>, { diff --git a/rust/sbp/src/sbp_string.rs b/rust/sbp/src/sbp_string.rs index 19191f95f7..0256b46ab7 100644 --- a/rust/sbp/src/sbp_string.rs +++ b/rust/sbp/src/sbp_string.rs @@ -165,7 +165,7 @@ impl<'de, E> serde::Deserialize<'de> for SbpString, E> { { struct SbpStringVisitor(PhantomData, E>>); - impl<'de, E> Visitor<'de> for SbpStringVisitor { + impl Visitor<'_> for SbpStringVisitor { type Value = SbpString, E>; fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { @@ -214,7 +214,7 @@ impl<'de, E, const LEN: usize> serde::Deserialize<'de> for SbpString<[u8; LEN], struct SbpStringVisitor(PhantomData>); - impl<'de, E, const LEN: usize> Visitor<'de> for SbpStringVisitor { + impl Visitor<'_> for SbpStringVisitor { type Value = SbpString<[u8; LEN], E>; fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {