cargo_release/ops/
diff.rs

1use std::path::Path;
2
3use similar::TextDiff;
4
5pub(crate) fn unified_diff(old: &str, new: &str, path: &Path, new_description: &str) -> String {
6    let diff = TextDiff::from_lines(old, new);
7    let path = path.display();
8    diff.unified_diff()
9        .header(
10            &format!("{path}\toriginal"),
11            &format!("{path}\t{new_description}"),
12        )
13        .to_string()
14}