Skip to content

Commit

Permalink
clippy..
Browse files Browse the repository at this point in the history
  • Loading branch information
aawsome committed Sep 29, 2024
1 parent 7bf0ea4 commit 0741576
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions crates/core/src/commands/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ impl ReadSubsetOption {
self.apply_with_rng(packs, &mut thread_rng())
}

// we need some casts to compute percentage...
#[allow(clippy::cast_possible_truncation)]
#[allow(clippy::cast_precision_loss)]
#[allow(clippy::cast_sign_loss)]
fn apply_with_rng(
self,
packs: impl IntoIterator<Item = IndexPack>,
Expand All @@ -72,6 +68,10 @@ impl ReadSubsetOption {
// Apply read-subset option
if let Some(mut size) = match self {
Self::All => None,
// we need some casts to compute percentage...
#[allow(clippy::cast_possible_truncation)]
#[allow(clippy::cast_precision_loss)]
#[allow(clippy::cast_sign_loss)]
Self::Percentage(p) => Some((total_size as f64 * p / 100.0) as u64),
Self::Size(s) => Some(s),
Self::IdSubSet((n, m)) => {
Expand Down Expand Up @@ -654,6 +654,10 @@ mod tests {
#[case("5/12")]
#[case("5%")]
#[case("250MiB")]
// we need some casts to compute percentage...
#[allow(clippy::cast_possible_truncation)]
#[allow(clippy::cast_precision_loss)]
#[allow(clippy::cast_sign_loss)]
fn test_read_subset(mut rng: StdRng, #[case] s: &str) {
let size =
|packs: &[IndexPack]| -> u64 { packs.iter().map(|p| u64::from(p.pack_size())).sum() };
Expand Down

0 comments on commit 0741576

Please sign in to comment.