Skip to content

Commit

Permalink
chore: clippy and rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
dilawar committed Feb 12, 2024
1 parent 1e03ef6 commit 34fe99c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 3 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ impl<F: Float + FromPrimitive + AddAssign + SubAssign + std::default::Default>
..Default::default()
};

for &v in slice.into_iter() {
for &v in slice.iter() {
k.push(v);
}
k
Expand Down Expand Up @@ -213,10 +213,8 @@ impl<F: Float + FromPrimitive + AddAssign + SubAssign + std::default::Default>
self.kurtosis.update(y);

// we just change the already held value and keep on rewriting it
if self.fixed_capacity {
if self.data.len() == self.data.capacity() {
self.data.pop_front();
}
if self.fixed_capacity && self.data.len() == self.data.capacity() {
self.data.pop_front();
}
self.data.push_back(y);

Expand Down
4 changes: 2 additions & 2 deletions tests/test_accumulator_fixed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ fn test_only_n_recent_values() {

#[test]
fn test_sanity() {
let mut acc = SimpleAccumulator::with_fixed_capacity(&vec![], 3);
let mut acc = SimpleAccumulator::with_fixed_capacity(&[], 3);
acc.push(1.0);
acc.push(2.0);
assert_float_eq!(acc.mean(), 1.5, abs_all <= 1e-4);
Expand All @@ -91,7 +91,7 @@ fn test_sanity_with_random_values() {
use watermill::stats::Univariate;
use watermill::variance::Variance;

let mut acc = SimpleAccumulator::with_fixed_capacity(&vec![], 10);
let mut acc = SimpleAccumulator::with_fixed_capacity(&[], 10);
let mut running_median: Quantile<f64> = Quantile::new(0.5f64).unwrap();
let mut running_var: Variance<f64> = Variance::default();

Expand Down

0 comments on commit 34fe99c

Please sign in to comment.