Skip to content

Commit 44df1c5

Browse files
committed
review comment: remove redundant empty(), use Default instead
JoinQualityMetrics had both a const fn empty() and a derived Default that produced identical zero-values. Since empty() was not used in a const context, remove it and use Default::default() at the one callsite to eliminate the drift risk. #166 (comment)
1 parent d35e686 commit 44df1c5

File tree

1 file changed

+1
-21
lines changed

1 file changed

+1
-21
lines changed

crates/mujou-pipeline/src/mst_join.rs

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1572,7 +1572,7 @@ pub fn join_mst(
15721572
let polylines: Vec<&Polyline> = contours.iter().filter(|c| !c.is_empty()).collect();
15731573

15741574
if polylines.is_empty() {
1575-
return (Polyline::new(Vec::new()), JoinQualityMetrics::empty());
1575+
return (Polyline::new(Vec::new()), JoinQualityMetrics::default());
15761576
}
15771577

15781578
if polylines.len() == 1 {
@@ -1672,26 +1672,6 @@ pub fn join_mst(
16721672
(polyline, metrics)
16731673
}
16741674

1675-
impl JoinQualityMetrics {
1676-
/// Metrics for an empty input (no contours to join).
1677-
#[must_use]
1678-
const fn empty() -> Self {
1679-
Self {
1680-
mst_edge_count: 0,
1681-
total_mst_edge_weight: 0.0,
1682-
max_mst_edge_weight: 0.0,
1683-
odd_vertices_before_fix: 0,
1684-
odd_vertices_after_fix: 0,
1685-
total_retrace_distance: 0.0,
1686-
total_path_length: 0.0,
1687-
graph_node_count: 0,
1688-
graph_edge_count_before_fix: 0,
1689-
graph_edge_count_after_fix: 0,
1690-
mst_edge_details: Vec::new(),
1691-
}
1692-
}
1693-
}
1694-
16951675
/// Compute the total Euclidean length of a `Polyline`.
16961676
fn path_polyline_length(polyline: &Polyline) -> f64 {
16971677
let pts = polyline.points();

0 commit comments

Comments
 (0)