Skip to content

Commit

Permalink
more clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
clbarnes committed Jan 18, 2024
1 parent 560c2d0 commit 7bb2855
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 23 deletions.
8 changes: 5 additions & 3 deletions nblast-rs/benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ fn read_all_points() -> Vec<Vec<Point3>> {
NAMES.iter().map(|n| read_points(n)).collect()
}

fn match_nonmatch(repeats: usize) -> (Vec<Vec<Point3>>, Vec<Vec<usize>>, Vec<Vec<usize>>) {
pub type MatchNonmatch = (Vec<Vec<Point3>>, Vec<Vec<usize>>, Vec<Vec<usize>>);

fn match_nonmatch(repeats: usize) -> MatchNonmatch {
let n_csvs = NAMES.len();
let mut out_points = Vec::with_capacity(n_csvs * repeats);
let all_points = read_all_points();
Expand All @@ -98,7 +100,7 @@ fn match_nonmatch(repeats: usize) -> (Vec<Vec<Point3>>, Vec<Vec<usize>>, Vec<Vec

let rng = Rng::with_seed(1991);

for rep in 0..repeats {
for (rep, nm) in nonmatches.iter_mut().enumerate() {
let aug = PointAug::new_random(
0.5, // 500nm
0.02, // 20nm
Expand All @@ -110,7 +112,7 @@ fn match_nonmatch(repeats: usize) -> (Vec<Vec<Point3>>, Vec<Vec<usize>>, Vec<Vec
let global_p_idx = offset + p_idx;
out_points.push(aug.augment_all(ps));
matches[p_idx].push(global_p_idx);
nonmatches[rep].push(global_p_idx);
nm.push(global_p_idx);
}
}

Expand Down
4 changes: 2 additions & 2 deletions nblast-rs/src/neurons/nabo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ impl NaboTangentsAlphas {
tree,
points_tangents_alphas: points
.into_iter()
.zip(tangents_alphas.into_iter())
.zip(tangents_alphas)
.collect(),
}
}
Expand All @@ -122,7 +122,7 @@ impl NaboTangentsAlphas {
tree,
points_tangents_alphas: points
.into_iter()
.zip(tangents_alphas.into_iter())
.zip(tangents_alphas)
.collect(),
}
}
Expand Down
18 changes: 0 additions & 18 deletions nblast-rs/src/smat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -594,21 +594,3 @@ fn log_odds_ratio(match_counts: Vec<Precision>, nonmatch_counts: Vec<Precision>)
})
.collect()
}

#[cfg(test)]
mod test {
use super::*;

fn assert_slice_eq(test: &[Precision], reference: &[Precision]) {
let msg = format!("\ttest: {:?}\n\t ref: {:?}", test, reference);
if test.len() != reference.len() {
panic!("Slices have different length\n{}", msg);
}

for (test_val, ref_val) in test.iter().zip(reference.iter()) {
if (test_val - ref_val).abs() > Precision::EPSILON {
panic!("Slices mave mismatched values\n{}", msg)
}
}
}
}

0 comments on commit 7bb2855

Please sign in to comment.