Illustrative: how the 658 code-grade loop improved meshfit/fit.rs#185
Open
bddap-bot wants to merge 1 commit into
Open
Illustrative: how the 658 code-grade loop improved meshfit/fit.rs#185bddap-bot wants to merge 1 commit into
bddap-bot wants to merge 1 commit into
Conversation
Three small dedups, all deletion-first: - four sort sites inlined the same NaN-safe float comparator; they now call the stdlib total order (f32/f64::total_cmp) directly, so there's no bespoke comparator to keep. - covariance_eigenframe computes the centroid it needs for the covariance instead of every caller computing and passing one in. - it no longer returns the eigenvalue magnitudes: they only order the axes, and no caller read them. Resolves the file's one code-grade Work (dry-not-overboard) and lifts simplicity and taste; behaviour-preserving (the two meshfit::fit tests pass, clippy clean).
bddap-bot
force-pushed
the
illustrate-658-base
branch
from
June 30, 2026 23:08
940c4bf to
59b5c3e
Compare
bddap-bot
force-pushed
the
illustrate-658
branch
from
June 30, 2026 23:08
329e873 to
2ee04b2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The job-658 code-grade loop on
crab-world/src/bot/meshfit/fit.rs, round by round. base←head diff = exactly the fit.rs change that landed inmain(81af11a), net −5 lines. Every fix is a deletion, not an addition.The fan-out
24 calibrated criteria → 8 fresh grading subs (
ceil(24/3)), each handed 3 random non-overlapping criteria. One came backWork.Round 1 — grade → single-source the dups
Work: dry-not-overboard. Apartial_cmp().unwrap_or(Equal)comparator inlined at 4 sort sites;centroid+covariance_eigenframerecomputed in bothfit_capsuleandscore_capsule.Deletion: callers stop computing/passing the centroid —
covariance_eigenframecomputes the one it needs, in the one place that needs it.Reviewer round 1 — delete the bespoke comparator
correctness · security · API · Niko-taste pass: the hand-rolled NaN-safe comparator reinvents stdlib.
Deletion:
sort_by(f32::total_cmp)at every site — the closure is gone, not abstracted into a helper.Reviewer round 2 (the round past "done") — drop the unused return
covariance_eigenframereturned an eigenvalue-magnitude tuple no caller read; the eigenvalues only order the axes.Deletion: signature shrinks
([Vec3;3], Vec3)→(Vec3, [Vec3;3]).Result
18 Perfect / 4 Good / 0 Work / 2 NA (grade db @
81af11a).cargo test(bothmeshfit::fittests) + clippy clean. Net −5 lines, behaviour-preserving.