mitsuhiko / similar

A high level diffing library for rust based on diffs
https://insta.rs/similar
Apache License 2.0
949 stars 31 forks source link

Are implementaions of `to_writer()` and `Display::fmt()` intentionally duplicated for `::udiff::{UnifiedDiff, UnifiedDiffHunk}`? #54

Closed nc7s closed 8 months ago

nc7s commented 10 months ago

Take UnifiedDiff as an example:

https://github.com/mitsuhiko/similar/blob/2b31f65445df9093ba007ca5a5ae6a71b899d491/src/udiff.rs#L181-L194

https://github.com/mitsuhiko/similar/blob/2b31f65445df9093ba007ca5a5ae6a71b899d491/src/udiff.rs#L298-L314

mitsuhiko commented 8 months ago

One is limited to unicode, the other one works for all bytes. That's why there are minor differences between the two. Could probably be written with less repetition, but this was easier.