Skip to content

Commit

Permalink
Fix clippy warnings + cargo update
Browse files Browse the repository at this point in the history
  • Loading branch information
r3dlight committed Feb 5, 2024
1 parent cccecec commit fa7ffeb
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 102 deletions.
145 changes: 48 additions & 97 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/file/receive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ where
.read(false)
.write(true)
.create(true)
.truncate(true)
.open(&file_path)?;

log::debug!("setting mode to {}", header.mode);
Expand Down
10 changes: 5 additions & 5 deletions src/receive/reblock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@ fn discard_queues_outside_retention_window(
if !retain && (v.len() < nb_normal_packets) {
log::warn!("discarding incomplete block {k} (currently on block {leading_block_id})")
}
return retain;
retain
});
}

// Returns true if block_id is between (leading_block_id - window_size) and
// leading_block_id; otherwise, returns false.
fn is_in_retention_window(block_id: u8, leading_block_id: u8, window_size: u8) -> bool {
return is_in_wrapped_interval(
is_in_wrapped_interval(
block_id,
(
leading_block_id.wrapping_sub(window_size - 1),
leading_block_id,
),
);
)
}

// Returns true if value is between (leading_block_id - window_size) and
Expand All @@ -42,10 +42,10 @@ fn is_in_wrapped_interval(value: u8, interval: (u8, u8)) -> bool {
let (lower_bound, upper_bound) = interval;
if lower_bound < upper_bound {
// continuous interval like within 32-48
return lower_bound <= value && value <= upper_bound;
lower_bound <= value && value <= upper_bound
} else {
// wrapped interval like (0-8 or 248-255)
return value <= upper_bound || lower_bound <= value;
value <= upper_bound || lower_bound <= value
}
}

Expand Down

0 comments on commit fa7ffeb

Please sign in to comment.