Skip to content

Commit

Permalink
clippy: Fix legacy_numeric_constants lint (#207)
Browse files Browse the repository at this point in the history
  • Loading branch information
waywardmonkeys authored Jun 21, 2024
1 parent 43b3fa1 commit c7c7f19
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
9 changes: 4 additions & 5 deletions src/transformation/convex_hull3/convex_hull.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ fn attach_and_push_facets(
continue;
}

let mut furthest = usize::max_value();
let mut furthest = usize::MAX;
let mut furthest_dist = 0.0;

for (i, curr_facet) in new_facets.iter_mut().enumerate() {
Expand All @@ -372,8 +372,7 @@ fn attach_and_push_facets(
}
}

if furthest != usize::max_value()
&& new_facets[furthest].can_see_point(*visible_point, points)
if furthest != usize::MAX && new_facets[furthest].can_see_point(*visible_point, points)
{
new_facets[furthest].add_visible_point(*visible_point, points);
}
Expand All @@ -387,7 +386,7 @@ fn attach_and_push_facets(
let mut i = 0;

while i != undecidable.len() {
let mut furthest = usize::max_value();
let mut furthest = usize::MAX;
let mut furthest_dist = 0.0;
let undecidable_point = undecidable[i];

Expand All @@ -402,7 +401,7 @@ fn attach_and_push_facets(
}
}

if furthest != usize::max_value() {
if furthest != usize::MAX {
new_facets[furthest].add_visible_point(undecidable_point, points);
let _ = undecidable.swap_remove(i);
} else {
Expand Down
8 changes: 4 additions & 4 deletions src/transformation/convex_hull3/initial_mesh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ pub fn try_get_initial_mesh(
.ok_or(ConvexHullError::MissingSupportPoint)?;

let mut max_area = 0.0;
let mut p3 = usize::max_value();
let mut p3 = usize::MAX;

for (i, point) in normalized_points.iter().enumerate() {
let area =
Expand All @@ -164,7 +164,7 @@ pub fn try_get_initial_mesh(
}
}

if p3 == usize::max_value() {
if p3 == usize::MAX {
Err(ConvexHullError::InternalError("no triangle found."))
} else {
// Build two facets with opposite normals
Expand All @@ -187,7 +187,7 @@ pub fn try_get_initial_mesh(
continue;
}

let mut furthest = usize::max_value();
let mut furthest = usize::MAX;
let mut furthest_dist = 0.0;

for (i, curr_facet) in facets.iter().enumerate() {
Expand All @@ -201,7 +201,7 @@ pub fn try_get_initial_mesh(
}
}

if furthest != usize::max_value() {
if furthest != usize::MAX {
facets[furthest].add_visible_point(point, normalized_points);
} else {
undecidable.push(point);
Expand Down

0 comments on commit c7c7f19

Please sign in to comment.