Skip to content

Commit b2366c1

Browse files
committed
style: Some clippy fixes
1 parent 16d2235 commit b2366c1

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

src/hamiltonian.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ pub struct DivergenceInfo {
3030
pub non_reversible: bool,
3131
}
3232

33+
impl Default for DivergenceInfo {
34+
fn default() -> Self {
35+
Self::new()
36+
}
37+
}
38+
3339
impl DivergenceInfo {
3440
pub fn new() -> Self {
3541
DivergenceInfo {
@@ -57,7 +63,7 @@ impl DivergenceInfo {
5763
// TODO
5864
start_momentum: None,
5965
start_idx_in_trajectory: Some(start.index_in_trajectory()),
60-
end_location: Some(math.box_array(&stop.point().position())),
66+
end_location: Some(math.box_array(stop.point().position())),
6167
end_idx_in_trajectory: Some(stop.index_in_trajectory()),
6268
// TODO
6369
energy_error: None,

src/mass_matrix.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ pub trait MassMatrix<M: Math>: SamplerStats<M> {
2424
);
2525
}
2626

27-
pub struct NullCollector {}
28-
29-
impl<M: Math, P: Point<M>> Collector<M, P> for NullCollector {}
30-
3127
#[derive(Debug)]
3228
pub struct DiagMassMatrix<M: Math> {
3329
inv_stds: M::Vector,

src/nuts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ impl<M: Math, H: Hamiltonian<M>, C: Collector<M, H::Point>> NutsTree<M, H, C> {
306306
LeapfrogResult::Err(err) => {
307307
return Err(NutsError::LogpFailure(err.into()));
308308
}
309-
};
309+
}
310310

311311
// We did not reject in the backward direction, so we are not reversible
312312
reversible = false;

src/transform_adapt_strategy.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ impl<M: Math> AdaptStrategy<M> for TransformAdaptation {
221221

222222
if draw < self.final_window_size {
223223
if draw < 100 {
224-
if (draw > 0) & (draw % 10 == 0) {
224+
if (draw > 0) & draw.is_multiple_of(10) {
225225
hamiltonian.update_params(
226226
math,
227227
rng,
@@ -230,7 +230,7 @@ impl<M: Math> AdaptStrategy<M> for TransformAdaptation {
230230
collector.collector2.logps.iter(),
231231
)?;
232232
}
233-
} else if (draw > 0) & (draw % self.options.transform_update_freq == 0) {
233+
} else if (draw > 0) & draw.is_multiple_of(self.options.transform_update_freq) {
234234
hamiltonian.update_params(
235235
math,
236236
rng,

0 commit comments

Comments
 (0)