Repository navigation
Let Extractor::new take a reference or an AnalysisType, and shorten compare_birthmarks - #215
Merged
Merged
Conversation
Extractor::new takes `impl Into<BirthmarkType>`, and BirthmarkType converts from &BirthmarkType, AnalysisType and &AnalysisType. A caller holding an analysis or a borrowed birthmark type passes it as it is, rather than cloning the birthmark type out first; an owned BirthmarkType is still moved in without a copy.
The comparison of an empty birthmark is made by empty_comparison, and each birthmark's functions are mapped by Birthmark::function_mapper, so compare_birthmarks reads as the steps it takes.
…lifetime Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
compare_birthmarks took both lists of sizes from the first birthmark, so the weighted aggregator refused any pair whose birthmarks held different numbers of functions, and weighted by the wrong sizes when they held the same.
Two birthmarks of the same number of functions but different sizes, so that taking both sides' sizes from one birthmark passes every length check and is caught by the score alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
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.



Extractor::new
Extractor::newtakesimpl Into<BirthmarkType>, andBirthmarkTypeconverts from&BirthmarkType,AnalysisTypeand&AnalysisType.Extractor::new(&analysis)rather thanExtractor::new(analysis.birthmark().clone()).BirthmarkTypeis still moved in without a copy, and code that passed one compiles unchanged..github/public-api.txtis updated for the new signature and the threeFromimpls, and v0.9.0's release notes say what changed.compare_birthmarks
compare_birthmarksis split so that it reads as the steps it takes:empty_comparisonmakes the comparison of an empty birthmark.Birthmark::function_mappermaps each birthmark's functions. Its lifetime lets the closure return what borrows from the functions, such as theCow<Data>thatin_shapereturns.cargo test --features mcp(410 tests, doctests included), clippy with-D warningsand the public API check pass locally.🤖 Generated with Claude Code