Skip to content

Fix multi-hunk serialization bug, clippy warnings, and documentation issues#1

Merged
sphaso merged 1 commit into
sphaso:mainfrom
lucazulian:fix/clippy-and-code-quality
Mar 1, 2026
Merged

Fix multi-hunk serialization bug, clippy warnings, and documentation issues#1
sphaso merged 1 commit into
sphaso:mainfrom
lucazulian:fix/clippy-and-code-quality

Conversation

@lucazulian
Copy link
Copy Markdown
Contributor

Bug fix:

  • Fix Vec<Hunk>::to_patch() concatenating hunks without newline separator, producing invalid unified diff format (e.g. ' d@@ -6,4 +6,4 @@')

Clippy fixes:

  • Replace if/else if chain with match + cmp in apply() (comparison_chain)
  • Replace redundant closures with method references (redundant_closure_for_method_calls)
  • Add missing semicolons in traceback() (semicolon_if_nothing_returned)
  • Remove unnecessary semicolon in HunkBuilder::process()
  • Replace wildcard import with explicit imports in diffable.rs

Documentation fixes:

  • Fix broken rustdoc links: Hunk -> patch::Hunk, Change -> recursive::Change
  • Add backticks around Edit::Equal in Hunk doc comment (doc_markdown)
  • Add backticks around PatchError in apply() doc comment
  • Add # Errors section to apply() and FromPatch::from_patch() docs

Tests:

  • Add test_multi_hunk_patch_format to verify @@ headers are on their own line
  • Add test_multi_hunk_roundtrip to verify serialize/deserialize with multiple hunks

…issues

Bug fix:
- Fix Vec<Hunk<T>>::to_patch() concatenating hunks without newline separator,
  producing invalid unified diff format (e.g. ' d@@ -6,4 +6,4 @@')

Clippy fixes:
- Replace if/else if chain with match + cmp in apply() (comparison_chain)
- Replace redundant closures with method references (redundant_closure_for_method_calls)
- Add missing semicolons in traceback() (semicolon_if_nothing_returned)
- Remove unnecessary semicolon in HunkBuilder::process()
- Replace wildcard import with explicit imports in diffable.rs

Documentation fixes:
- Fix broken rustdoc links: Hunk -> patch::Hunk, Change -> recursive::Change
- Add backticks around Edit::Equal in Hunk doc comment (doc_markdown)
- Add backticks around PatchError in apply() doc comment
- Add # Errors section to apply() and FromPatch::from_patch() docs

Tests:
- Add test_multi_hunk_patch_format to verify @@ headers are on their own line
- Add test_multi_hunk_roundtrip to verify serialize/deserialize with multiple hunks
@sphaso sphaso merged commit df57014 into sphaso:main Mar 1, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants