Skip to content

Commit c9dc1bb

Browse files
07-C9SomethingNew71
authored andcommitted
style: cargo fmt
1 parent f248745 commit c9dc1bb

2 files changed

Lines changed: 15 additions & 6 deletions

File tree

src/parsers/link.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,11 @@ impl Link {
165165
/// - 200 bytes past the start of the ID is a UTF-16 LE unit string.
166166
///
167167
/// Returns `None` if no plausible channel header is found.
168-
fn parse_ds3_channel(data: &[u8], block_offset: usize, block_size: usize) -> Option<LinkChannel> {
168+
fn parse_ds3_channel(
169+
data: &[u8],
170+
block_offset: usize,
171+
block_size: usize,
172+
) -> Option<LinkChannel> {
169173
let content_start = block_offset + 8;
170174
let content_end = block_offset + block_size;
171175
// Scan for: low-id u32 (two high bytes zero, low two nonzero) followed by
@@ -181,9 +185,7 @@ impl Link {
181185
let b3 = data[p + 3];
182186
let nb = data[p + 4];
183187
let nb1 = data[p + 5];
184-
if b2 == 0 && b3 == 0 && (b0 | b1) != 0
185-
&& (0x20..=0x7e).contains(&nb) && nb1 == 0
186-
{
188+
if b2 == 0 && b3 == 0 && (b0 | b1) != 0 && (0x20..=0x7e).contains(&nb) && nb1 == 0 {
187189
let channel_id = Self::read_u32(data, p);
188190
// Sanity-check: channel IDs are small positive integers
189191
if !(1..10_000).contains(&channel_id) {
@@ -317,7 +319,10 @@ impl Link {
317319
0.0
318320
} else {
319321
match points.binary_search_by(|probe| {
320-
probe.0.partial_cmp(&time).unwrap_or(std::cmp::Ordering::Equal)
322+
probe
323+
.0
324+
.partial_cmp(&time)
325+
.unwrap_or(std::cmp::Ordering::Equal)
321326
}) {
322327
Ok(idx) => points[idx].1,
323328
Err(idx) => {

tests/parsers/link_tests.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ fn assert_plausible_link_timing(log: &ultralog::parsers::types::Log) {
2727
let times = log.get_times_as_f64();
2828
assert!(!times.is_empty(), "Log should have timestamps");
2929
let last = *times.last().unwrap();
30-
assert!(last.is_finite(), "Last timestamp must be finite, got {}", last);
30+
assert!(
31+
last.is_finite(),
32+
"Last timestamp must be finite, got {}",
33+
last
34+
);
3135
assert!(
3236
last < 3600.0,
3337
"Last timestamp {}s implausibly large (>1 hour); parser likely misreading bytes as f32",

0 commit comments

Comments
 (0)