Skip to content

Commit

Permalink
Fix (almost) all clippy complaints
Browse files Browse the repository at this point in the history
  • Loading branch information
hugoledoux committed Jan 15, 2024
1 parent 5e9f626 commit 2bbdec5
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 132 deletions.
20 changes: 10 additions & 10 deletions src/geom/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ pub fn orient2d(a: &[f64], b: &[f64], c: &[f64], robust_predicates: bool) -> i8
//-- CCW = +1
//-- CW = -1
//-- colinear = 0
if robust_predicates == true {
return orient2d_robust(&a, &b, &c);
if robust_predicates {
orient2d_robust(&a, &b, &c)
} else {
return orient2d_fast(&a, &b, &c);
orient2d_fast(&a, &b, &c)
}
}

Expand All @@ -63,7 +63,7 @@ pub fn orient2d_robust(a: &[f64], b: &[f64], c: &[f64]) -> i8 {
robust::Coord { x: c[0], y: c[1] },
);
if re == 0.0_f64 {
return 0;
0
} else if re.is_sign_positive() {
return 1;
} else {
Expand All @@ -77,7 +77,7 @@ pub fn orient2d_fast(a: &[f64], b: &[f64], c: &[f64]) -> i8 {
//-- colinear = 0
let re: f64 = ((a[0] - c[0]) * (b[1] - c[1])) - ((a[1] - c[1]) * (b[0] - c[0]));
if re.abs() < 1e-12 {
return 0;
0
} else if re > 0.0 {
return 1;
} else {
Expand All @@ -89,10 +89,10 @@ pub fn incircle(a: &[f64], b: &[f64], c: &[f64], p: &[f64], robust_predicates: b
//-- p is INSIDE == +1
//-- p is OUTSIDE == -1
//-- p is ONCIRCLE == 0
if robust_predicates == true {
return incircle_robust(&a, &b, &c, &p);
if robust_predicates {
incircle_robust(&a, &b, &c, &p)
} else {
return incircle_fast(&a, &b, &c, &p);
incircle_fast(&a, &b, &c, &p)
}
}

Expand All @@ -107,7 +107,7 @@ pub fn incircle_robust(a: &[f64], b: &[f64], c: &[f64], p: &[f64]) -> i8 {
robust::Coord { x: p[0], y: p[1] },
);
if re == 0.0_f64 {
return 0;
0
} else if re.is_sign_positive() {
return 1;
} else {
Expand Down Expand Up @@ -140,7 +140,7 @@ pub fn incircle_fast(a: &[f64], b: &[f64], c: &[f64], p: &[f64]) -> i8 {
let re = i - j + k;
// println!("INCIRCLE TEST: {}", re);
if re.abs() < 1e-12 {
return 0;
0
} else if re > 0.0 {
return 1;
} else {
Expand Down
10 changes: 5 additions & 5 deletions src/interpolation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ impl Interpolant for Laplace {
let mut re: Vec<Result<f64, StartinError>> = Vec::new();
for p in locs {
//-- cannot interpolate if no TIN
if dt.is_init == false {
if !dt.is_init {
re.push(Err(StartinError::EmptyTriangulation));
continue;
}
Expand Down Expand Up @@ -155,7 +155,7 @@ impl Interpolant for NN {
let mut re: Vec<Result<f64, StartinError>> = Vec::new();
for p in locs {
//-- cannot interpolation if no TIN
if dt.is_init == false {
if !dt.is_init {
re.push(Err(StartinError::EmptyTriangulation));
continue;
}
Expand All @@ -180,7 +180,7 @@ impl Interpolant for TIN {
let mut re: Vec<Result<f64, StartinError>> = Vec::new();
for p in locs {
//-- cannot interpolate if no TIN
if dt.is_init == false {
if !dt.is_init {
re.push(Err(StartinError::EmptyTriangulation));
continue;
}
Expand Down Expand Up @@ -225,7 +225,7 @@ impl Interpolant for NNI {
vorareas.reserve_exact(dt.stars.len());
vorareas.push(0.);
for vi in 1..dt.stars.len() {
if dt.stars[vi].is_deleted() == false {
if !dt.stars[vi].is_deleted() {
vorareas.push(dt.voronoi_cell_area(vi, true).unwrap());
} else {
vorareas.push(0.);
Expand All @@ -235,7 +235,7 @@ impl Interpolant for NNI {
let mut re: Vec<Result<f64, StartinError>> = Vec::new();
for p in locs {
//-- cannot interpolate if no TIN
if dt.is_init == false {
if !dt.is_init {
re.push(Err(StartinError::EmptyTriangulation));
continue;
}
Expand Down
Loading

0 comments on commit 2bbdec5

Please sign in to comment.