diff --git a/justfile b/justfile index 5d773d0..acd29ee 100644 --- a/justfile +++ b/justfile @@ -1,4 +1,4 @@ -all: check build embedded test clippy check-fmt docs coverage +all: check build clippy embedded test check-fmt docs coverage clippy: cargo clippy -- -D warnings diff --git a/src/time/cuc.rs b/src/time/cuc.rs index 876a360..4ca8e13 100644 --- a/src/time/cuc.rs +++ b/src/time/cuc.rs @@ -452,7 +452,7 @@ impl CucTime { .ok_or(CucError::LeapSecondCorrectionError)?; let fractions = fractional_part_from_subsec_ns(res, unix_time.subsec_millis() as u64 * 10_u64.pow(6)); - Self::new_generic(WidthCounterPair(4, counter as u32), fractions) + Self::new_generic(WidthCounterPair(4, counter), fractions) } /// Most generic constructor which allows full configurability for the counter and for the diff --git a/src/uslp/mod.rs b/src/uslp/mod.rs index 5e50c1c..90a50fa 100644 --- a/src/uslp/mod.rs +++ b/src/uslp/mod.rs @@ -255,10 +255,8 @@ impl PrimaryHeader { | ((self.protocol_control_command_flag as u8) << 6) | ((self.ocf_flag as u8) << 3) | self.vc_frame_count_len.as_u8(); - let mut packet_idx = 7; - for idx in (0..self.vc_frame_count_len.value()).rev() { + for (packet_idx, idx) in (7..).zip((0..self.vc_frame_count_len.value()).rev()) { buf[packet_idx] = ((self.vc_frame_count >> (idx * 8)) & 0xff) as u8; - packet_idx += 1; } Ok(self.len_header()) }