Skip to content

Commit

Permalink
Fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
vks committed May 13, 2021
1 parent b77674d commit dc8741e
Show file tree
Hide file tree
Showing 14 changed files with 8 additions and 30 deletions.
6 changes: 2 additions & 4 deletions benches/kurtosis.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![cfg_attr(feature = "cargo-clippy", allow(clippy::float_cmp, map_clone))]

use bencher::{Bencher, benchmark_group, benchmark_main};

/// Create a random vector by sampling from a normal distribution.
Expand All @@ -21,15 +19,15 @@ fn initialize_vec() -> Vec<f64> {
fn bench_kurtosis(b: &mut Bencher) {
let values = initialize_vec();
b.iter(|| {
let m: average::Kurtosis = values.iter().map(|x| *x).collect();
let m: average::Kurtosis = values.iter().copied().collect();
m
});
}

fn bench_moments(b: &mut Bencher) {
let values = initialize_vec();
b.iter(|| {
let m: average::Moments4 = values.iter().map(|x| *x).collect();
let m: average::Moments4 = values.iter().copied().collect();
m
});
}
Expand Down
6 changes: 2 additions & 4 deletions benches/mean.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![cfg_attr(feature = "cargo-clippy", allow(clippy::float_cmp, map_clone))]

use bencher::{Bencher, benchmark_group, benchmark_main};

/// Create a random vector by sampling from a normal distribution.
Expand All @@ -21,15 +19,15 @@ fn initialize_vec() -> Vec<f64> {
fn bench_average(b: &mut Bencher) {
let values = initialize_vec();
b.iter(|| {
let m: average::MeanWithError = values.iter().map(|x| *x).collect();
let m: average::MeanWithError = values.iter().copied().collect();
m
});
}

fn bench_stats(b: &mut Bencher) {
let values = initialize_vec();
b.iter(|| {
let m: stats::OnlineStats = values.iter().map(|x| *x).collect();
let m: stats::OnlineStats = values.iter().copied().collect();
m
});
}
Expand Down
4 changes: 1 addition & 3 deletions benches/min.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![cfg_attr(feature = "cargo-clippy", allow(clippy::float_cmp, map_clone))]

use bencher::{Bencher, benchmark_group, benchmark_main};

/// Create a random vector of random floats in [0, 1].
Expand All @@ -21,7 +19,7 @@ fn initialize_vec() -> Vec<f64> {
fn bench_average(b: &mut Bencher) {
let values = initialize_vec();
b.iter(|| {
let a: average::Min = values.iter().map(|x| *x).collect();
let a: average::Min = values.iter().copied().collect();
a
});
}
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/histogram.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ fn from_ranges_invalid() {
Histogram10::from_ranges(invalid_order.iter().cloned()).unwrap_err(),
InvalidRangeError::NotSorted
);
let mut valid_empty_ranges = valid.clone();
let mut valid_empty_ranges = valid;
valid_empty_ranges[1] = 0.;
valid_empty_ranges[10] = 1.;
assert!(Histogram10::from_ranges(valid_empty_ranges.iter().cloned()).is_ok());
Expand Down
2 changes: 0 additions & 2 deletions tests/integration/kurtosis.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![cfg_attr(feature = "cargo-clippy", allow(clippy::float_cmp, map_clone))]

use core::iter::Iterator;

use average::{Kurtosis, Estimate, Merge, assert_almost_eq};
Expand Down
2 changes: 2 additions & 0 deletions tests/integration/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#![cfg_attr(feature = "nightly",
feature(const_generics, const_evaluatable_checked))]

#![allow(clippy::float_cmp)]

mod histogram;
#[cfg(feature = "nightly")]
mod histogram_const;
Expand Down
2 changes: 0 additions & 2 deletions tests/integration/max.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![cfg_attr(feature = "cargo-clippy", allow(clippy::float_cmp, map_clone))]

use core::iter::Iterator;

use average::{Max, Estimate, Merge};
Expand Down
2 changes: 0 additions & 2 deletions tests/integration/mean.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![cfg_attr(feature = "cargo-clippy", allow(clippy::float_cmp, map_clone))]

use core::iter::Iterator;

use average::{MeanWithError, Estimate, Merge};
Expand Down
2 changes: 0 additions & 2 deletions tests/integration/min.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![cfg_attr(feature = "cargo-clippy", allow(clippy::float_cmp, map_clone))]

use core::iter::Iterator;

use average::{Min, Estimate, Merge};
Expand Down
2 changes: 0 additions & 2 deletions tests/integration/moments.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![cfg_attr(feature = "cargo-clippy", allow(clippy::float_cmp, map_clone))]

use core::iter::Iterator;

use average::{Moments4, Merge, assert_almost_eq};
Expand Down
2 changes: 0 additions & 2 deletions tests/integration/quantile.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![cfg_attr(feature = "cargo-clippy", allow(clippy::float_cmp, map_clone))]

use average::{Estimate, Quantile};

#[test]
Expand Down
2 changes: 0 additions & 2 deletions tests/integration/random.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![cfg_attr(feature = "cargo-clippy", allow(clippy::float_cmp, map_clone))]

use rand_distr::Distribution;

use average::{Kurtosis, Estimate, assert_almost_eq};
Expand Down
2 changes: 0 additions & 2 deletions tests/integration/skewness.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![cfg_attr(feature = "cargo-clippy", allow(clippy::float_cmp, map_clone))]

use core::iter::Iterator;

use average::{Skewness, Estimate, Merge, assert_almost_eq};
Expand Down
2 changes: 0 additions & 2 deletions tests/integration/weighted_mean.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![cfg_attr(feature = "cargo-clippy", allow(clippy::float_cmp, map_clone))]

use core::iter::Iterator;

use average::{WeightedMeanWithError, Merge, assert_almost_eq};
Expand Down

0 comments on commit dc8741e

Please sign in to comment.