Skip to content

Commit

Permalink
chore: fixed lots of lints and other issues
Browse files Browse the repository at this point in the history
  • Loading branch information
nishaq503 committed Nov 30, 2024
1 parent d788f98 commit 4d9dee3
Show file tree
Hide file tree
Showing 23 changed files with 50 additions and 599 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ members = [
# "crates/results/rite-solutions",
"crates/results/msa",
"pypi/distances",
"pypi/results/cakes",
]
resolver = "2"

Expand Down
4 changes: 2 additions & 2 deletions crates/abd-clam/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ authors = [
"Oliver McLaughlin <[email protected]>",
]
edition = "2021"
rust-version = "1.83"
rust-version = "1.81" # using: `total_cmp`
description = "Clustering, Learning and Approximation with Manifolds"
license = "MIT"
readme = "./README.md"
Expand Down Expand Up @@ -82,4 +82,4 @@ required-features = ["msa"]
[[bench]]
name = "ann_benchmarks"
harness = false
required-features = ["ndarray-bindings"]
required-features = ["disk-io"]
4 changes: 1 addition & 3 deletions crates/abd-clam/src/cakes/cluster/permuted_ball.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ mod tests {
}

#[test]
fn permutation() -> Result<(), String> {
fn permutation() {
let data = gen_tiny_data();
let metric = Manhattan;

Expand All @@ -347,7 +347,5 @@ mod tests {

let (root, perm_data) = PermutedBall::par_from_ball_tree(ball, data, &metric);
assert!(check_permutation(&root, &perm_data, &metric));

Ok(())
}
}
6 changes: 2 additions & 4 deletions crates/abd-clam/src/cakes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ pub mod tests {
#[test_case(10_000, 10)]
#[test_case(1_000, 100)]
#[test_case(10_000, 100)]
fn vectors(car: usize, dim: usize) -> Result<(), String> {
fn vectors(car: usize, dim: usize) {
let mut algs: Algs<Vec<f32>, f32, usize> = vec![];
for radius in [0.1, 1.0] {
algs.push((Algorithm::RnnClustered(radius), check_search_by_index));
Expand Down Expand Up @@ -180,8 +180,6 @@ pub mod tests {
"par_off_ball",
&per_perm_data,
);

Ok(())
}

#[test_case::test_case(16, 16, 2)]
Expand Down Expand Up @@ -232,7 +230,7 @@ pub mod tests {
let (perm_ball, perm_data) = PermutedBall::from_ball_tree(ball.clone(), data.clone(), &metric);
check_search(&algs, &perm_data, &metric, &perm_ball, query, "off_ball", &perm_data);

let (par_perm_ball, par_perm_data) = PermutedBall::par_from_ball_tree(ball.clone(), data.clone(), &metric);
let (par_perm_ball, par_perm_data) = PermutedBall::par_from_ball_tree(ball, data, &metric);
check_search(
&algs,
&par_perm_data,
Expand Down
8 changes: 2 additions & 6 deletions crates/abd-clam/src/cakes/search/knn_breadth_first.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ mod tests {
};

#[test]
fn line() -> Result<(), String> {
fn line() {
let data = gen_line_data(10);
let metric = AbsoluteDifference;
let query = &0;
Expand All @@ -244,12 +244,10 @@ mod tests {
for k in [1, 4, 8] {
assert!(check_knn(&off_ball, &perm_data, &metric, query, k));
}

Ok(())
}

#[test]
fn grid() -> Result<(), String> {
fn grid() {
let data = gen_grid_data(10);
let metric = Hypotenuse;
let query = &(0.0, 0.0);
Expand All @@ -266,7 +264,5 @@ mod tests {
for k in [1, 4, 8] {
assert!(check_knn(&off_ball, &perm_data, &metric, query, k));
}

Ok(())
}
}
8 changes: 2 additions & 6 deletions crates/abd-clam/src/cakes/search/knn_depth_first.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ pub mod tests {
}

#[test]
fn line() -> Result<(), String> {
fn line() {
let data = gen_line_data(10);
let metric = AbsoluteDifference;
let query = &0;
Expand All @@ -241,12 +241,10 @@ pub mod tests {
for k in [1, 4, 8] {
assert!(check_knn(&off_ball, &perm_data, &metric, query, k));
}

Ok(())
}

#[test]
fn grid() -> Result<(), String> {
fn grid() {
let data = gen_grid_data(10);
let metric = Hypotenuse;
let query = &(0.0, 0.0);
Expand All @@ -263,7 +261,5 @@ pub mod tests {
for k in [1, 4, 8] {
assert!(check_knn(&off_ball, &perm_data, &metric, query, k));
}

Ok(())
}
}
8 changes: 2 additions & 6 deletions crates/abd-clam/src/cakes/search/knn_repeated_rnn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ mod tests {
}

#[test]
fn line() -> Result<(), String> {
fn line() {
let data = gen_line_data(10);
let metric = AbsoluteDifference;
let query = &0;
Expand All @@ -180,12 +180,10 @@ mod tests {
for k in [1, 4, 8] {
assert!(check_knn(&off_ball, &perm_data, &metric, query, k, max_multiplier));
}

Ok(())
}

#[test]
fn grid() -> Result<(), String> {
fn grid() {
let data = gen_grid_data(10);
let metric = Hypotenuse;
let query = &(0.0, 0.0);
Expand All @@ -203,7 +201,5 @@ mod tests {
for k in [1, 4, 8, 16, 32] {
assert!(check_knn(&off_ball, &perm_data, &metric, query, k, max_multiplier));
}

Ok(())
}
}
8 changes: 2 additions & 6 deletions crates/abd-clam/src/cakes/search/rnn_clustered.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ mod tests {
}

#[test]
fn line() -> Result<(), String> {
fn line() {
let data = gen_line_data(10);
let metric = AbsoluteDifference;
let query = &0;
Expand All @@ -253,12 +253,10 @@ mod tests {
for radius in 0..=4 {
assert!(check_rnn(&off_ball, &perm_data, &metric, query, radius));
}

Ok(())
}

#[test]
fn grid() -> Result<(), String> {
fn grid() {
let data = gen_grid_data(10);
let metric = Hypotenuse;
let query = &(0.0, 0.0);
Expand All @@ -275,7 +273,5 @@ mod tests {
for radius in [1.0, 4.0, 8.0, 16.0, 32.0] {
assert!(check_rnn(&off_ball, &perm_data, &metric, query, radius));
}

Ok(())
}
}
12 changes: 3 additions & 9 deletions crates/abd-clam/src/core/cluster/ball.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ mod tests {
}

#[test]
fn new() -> Result<(), String> {
fn new() {
let data = gen_tiny_data();
let metric = Manhattan;

Expand Down Expand Up @@ -366,8 +366,6 @@ mod tests {
assert_eq!(root.arg_radial(), arg_r);
assert!(root.children().is_empty());
assert_eq!(root.indices().collect::<Vec<_>>(), indices);

Ok(())
}

fn check_partition(root: &Ball<i32>) -> bool {
Expand Down Expand Up @@ -399,7 +397,7 @@ mod tests {
}

#[test]
fn tree() -> Result<(), String> {
fn tree() {
let data = gen_tiny_data();
let metric = Manhattan;

Expand All @@ -413,12 +411,10 @@ mod tests {
let root = Ball::par_new_tree(&data, &metric, &criteria, seed);
assert_eq!(root.indices().count(), data.cardinality());
assert!(check_partition(&root));

Ok(())
}

#[test]
fn partition_further() -> Result<(), String> {
fn partition_further() {
let data = gen_tiny_data();
let metric = Manhattan;

Expand All @@ -443,8 +439,6 @@ mod tests {
for leaf in root.leaves() {
assert_eq!(leaf.depth(), 2);
}

Ok(())
}

#[test]
Expand Down
120 changes: 0 additions & 120 deletions pypi/results/cakes/.github/workflows/CI.yml

This file was deleted.

Loading

0 comments on commit 4d9dee3

Please sign in to comment.