Skip to content

Commit 143d30f

Browse files
committed
style: Adjusted style for clippy.
1 parent 9671b6a commit 143d30f

File tree

15 files changed

+20
-37
lines changed

15 files changed

+20
-37
lines changed

benches/vonmises.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
use criterion::black_box;
2-
use criterion::measurement::WallTime;
32
use criterion::AxisScale;
43
use criterion::BatchSize;
54
use criterion::BenchmarkId;
65
use criterion::Criterion;
76
use criterion::PlotConfiguration;
8-
use criterion::Throughput;
97
use criterion::{criterion_group, criterion_main};
108
use rand::Rng;
119
use rv::dist::VonMises;
1210
use rv::misc::bessel::log_i0;
1311
use rv::prelude::*;
14-
use rv::traits::*;
1512
use std::f64::consts::PI;
1613

1714
fn bench_vm_draw(c: &mut Criterion) {

examples/betaprime_sbc.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use rv::dist::BetaPrime;
21

32
#[cfg(feature = "experimental")]
43
use rand::SeedableRng;
@@ -8,7 +7,6 @@ use rand_xoshiro::Xoshiro256Plus;
87
use rv::experimental::stick_breaking_process::{
98
StickBreaking, StickBreakingDiscrete, StickBreakingDiscreteSuffStat,
109
};
11-
use rv::prelude::*;
1210

1311
// Simulation-based calibration
1412
// For details see http://www.stat.columbia.edu/~gelman/research/unpublished/sbc.pdf

examples/sbd.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
use rand::SeedableRng;
2-
use rv::prelude::*;
31

42
#[cfg(feature = "experimental")]
53
use rv::experimental::stick_breaking_process::{

examples/stickbreaking_posterior.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
use itertools::Either;
2-
use peroxide::statistics::stat::Statistics;
3-
use rv::prelude::*;
41

52
#[cfg(feature = "experimental")]
63
use rv::experimental::stick_breaking_process::*;

src/data/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,8 +386,8 @@ mod tests {
386386
fn impl_bool_into_bool() {
387387
let t = true;
388388
let f = false;
389-
assert_eq!(t.into_bool(), true);
390-
assert_eq!(f.into_bool(), false);
389+
assert!(t.into_bool());
390+
assert!(!f.into_bool());
391391
}
392392

393393
#[test]

src/dist/betaprime.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ use std::f64;
1010
use std::fmt;
1111
use std::sync::OnceLock;
1212

13+
#[cfg(feature = "experimental")]
14+
use super::UnitPowerLaw;
15+
1316
/// [Beta prime distribution](https://en.wikipedia.org/wiki/Beta_prime_distribution),
1417
/// BetaPrime(α, β) over x in (0, ∞).
1518
///
@@ -277,18 +280,14 @@ impl Sampleable<f64> for BetaPrime {
277280
}
278281
}
279282

280-
use crate::data::DataOrSuffStat;
281283
#[cfg(feature = "experimental")]
282284
use crate::experimental::stick_breaking_process::{
283285
StickBreakingDiscrete, StickBreakingDiscreteSuffStat,
284286
};
285-
use crate::traits::ConjugatePrior;
286287

287288
#[cfg(feature = "experimental")]
288289
use crate::experimental::stick_breaking_process::StickBreaking;
289290

290-
use crate::prelude::UnitPowerLaw;
291-
292291
#[cfg(feature = "experimental")]
293292
impl Sampleable<StickBreakingDiscrete> for BetaPrime {
294293
fn draw<R: Rng>(&self, rng: &mut R) -> StickBreakingDiscrete {

src/dist/cdvm.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,10 +243,7 @@ impl HasSuffStat<usize> for Cdvm {
243243
// TODO: Should we cache twopimu_over_m.cos() and twopimu_over_m.sin()?
244244

245245
let (sin_twopimu_over_m, cos_twopimu_over_m) = twopimu_over_m.sin_cos();
246-
self.kappa
247-
* (stat.sum_cos() * cos_twopimu_over_m
248-
+ stat.sum_sin() * sin_twopimu_over_m)
249-
- stat.n() as f64 * self.log_norm_const()
246+
self.kappa.mul_add(stat.sum_cos().mul_add(cos_twopimu_over_m, stat.sum_sin() * sin_twopimu_over_m), -(stat.n() as f64 * self.log_norm_const()))
250247
}
251248
}
252249

src/dist/normal_gamma/gaussian_prior.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ impl ConjugatePrior<f64, Gaussian> for NormalGamma {
7878

7979
fn ln_pp_cache(&self, x: &DataOrSuffStat<f64, Gaussian>) -> Self::PpCache {
8080
extract_stat_then(self, x, |stat| {
81-
let params = posterior_from_stat(self, &stat);
81+
let params = posterior_from_stat(self, stat);
8282
let PosteriorParameters { r, s, v, .. } = params;
8383

8484
let half_v = v / 2.0;

src/dist/normal_inv_chi_squared/gaussian_prior.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,15 @@ impl ConjugatePrior<f64, Gaussian> for NormalInvChiSquared {
8888
) -> f64 {
8989
extract_stat_then(self, x, |stat: &GaussianSuffStat| {
9090
let n = stat.n() as f64;
91-
let post: Self = posterior_from_stat(self, &stat).into();
91+
let post: Self = posterior_from_stat(self, stat).into();
9292
let lnz_n = post.ln_z();
9393
n.mul_add(-HALF_LN_PI, lnz_n - cache)
9494
})
9595
}
9696

9797
fn ln_pp_cache(&self, x: &DataOrSuffStat<f64, Gaussian>) -> Self::PpCache {
9898
extract_stat_then(self, x, |stat: &GaussianSuffStat| {
99-
let post = posterior_from_stat(self, &stat);
99+
let post = posterior_from_stat(self, stat);
100100
let kn = post.kn;
101101
let vn = post.vn;
102102

src/dist/scaled_prior.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ where
171171
stat: &ScaledSuffStat<Fx::Stat>,
172172
) -> Self::Posterior {
173173
ScaledPrior::new_unchecked(
174-
self.parent.posterior_from_suffstat(&stat.parent()),
174+
self.parent.posterior_from_suffstat(stat.parent()),
175175
self.scale,
176176
)
177177
}

0 commit comments

Comments
 (0)