Repository navigation
refactor: derive Default for RequestRequirements - #247
Merged
FalkWoldmann merged 1 commit intoAug 7, 2026
Merged
FalkWoldmann merged 1 commit into
FalkWoldmann merged 1 commit into
Conversation
RequestRequirements::new listed all ~80 Option fields as None explicitly, and build_mock_definition repeated the same wall of None assignments. Every field is an Option, so Default is derivable and new() delegates to it. Also merge the duplicate private converters in data.rs (from_string_pair_vec was identical to to_name_value_string_pair_vec; from_pattern_vec was a needless clone).
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
What
RequestRequirementshas80 fields, all-95 lines).Options.new()listed every one of them asNoneexplicitly;derive(Default)replaces the hand-writtenDefaultimpl andnew()delegates to it (build_mock_definitioninsrc/server/state.rsrepeated the same wall of explicitNoneassignments; it now uses struct-update syntax with..Default::default()(~-80 lines).data.rs:from_string_pair_vecwas byte-for-byte identical toto_name_value_string_pair_vec, andfrom_pattern_vecwas a needless clone whose callers pass owned values.No public API or behaviour changes:
derive(Default)produces exactly the all-Nonevalue the manual impl did, serde attributes and field order are untouched, so the JSON/YAML serialization shape is unchanged.Overlap note
The converter cleanup in
data.rsalso appears in #246 (dead-code removal); the hunks are identical, so the PRs merge cleanly in either order.Verification
cargo test --all-featuresunit + integration suites pass locally (122 + 137 tests, including the record/playback tests that exercise the YAML serialization path).