From abec9dd448e73207531bd7efc3ccee54ff718844 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 23 Jan 2025 17:19:26 +0100 Subject: [PATCH] clippy and test fix --- satrs/Cargo.toml | 5 +++++ satrs/src/tmtc/tm_helper.rs | 24 ++++++++++++------------ 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/satrs/Cargo.toml b/satrs/Cargo.toml index 326d416..a57c335 100644 --- a/satrs/Cargo.toml +++ b/satrs/Cargo.toml @@ -131,3 +131,8 @@ test_util = [] [package.metadata.docs.rs] all-features = true rustdoc-args = ["--generate-link-to-definition"] + +[[test]] +name = "event_test" +path = "tests/pus_events.rs" +required-features = ["test_util"] diff --git a/satrs/src/tmtc/tm_helper.rs b/satrs/src/tmtc/tm_helper.rs index c8c488e..56bc99c 100644 --- a/satrs/src/tmtc/tm_helper.rs +++ b/satrs/src/tmtc/tm_helper.rs @@ -17,37 +17,37 @@ impl PusTmWithCdsShortHelper { } #[cfg(feature = "std")] - pub fn create_pus_tm_timestamp_now<'a>( - &'a mut self, + pub fn create_pus_tm_timestamp_now<'data>( + &mut self, service: u8, subservice: u8, - source_data: &'a [u8], + source_data: &'data [u8], seq_count: u16, - ) -> PusTmCreator { + ) -> PusTmCreator<'_, 'data> { let time_stamp = CdsTime::now_with_u16_days().unwrap(); time_stamp.write_to_bytes(&mut self.cds_short_buf).unwrap(); self.create_pus_tm_common(service, subservice, source_data, seq_count) } - pub fn create_pus_tm_with_stamper<'a>( - &'a mut self, + pub fn create_pus_tm_with_stamper<'data>( + &mut self, service: u8, subservice: u8, - source_data: &'a [u8], + source_data: &'data [u8], stamper: &CdsTime, seq_count: u16, - ) -> PusTmCreator { + ) -> PusTmCreator<'_, 'data> { stamper.write_to_bytes(&mut self.cds_short_buf).unwrap(); self.create_pus_tm_common(service, subservice, source_data, seq_count) } - fn create_pus_tm_common<'a>( - &'a self, + fn create_pus_tm_common<'data>( + &self, service: u8, subservice: u8, - source_data: &'a [u8], + source_data: &'data [u8], seq_count: u16, - ) -> PusTmCreator { + ) -> PusTmCreator<'_, 'data> { let reply_header = SpHeader::new_for_unseg_tm(self.apid, seq_count, 0); let tc_header = PusTmSecondaryHeader::new_simple(service, subservice, &self.cds_short_buf); PusTmCreator::new(reply_header, tc_header, source_data, true)