aboutsummaryrefslogtreecommitdiff
path: root/src/diff.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/diff.rs')
-rw-r--r--src/diff.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/diff.rs b/src/diff.rs
index 382c7db..442448f 100644
--- a/src/diff.rs
+++ b/src/diff.rs
@@ -9,7 +9,7 @@ pub fn diff(first: &str, second: &str) -> String {
return "<em>(no changes)</em>".into();
}
- let Changeset { diffs, .. } = Changeset::new(&first, &second, "\n");
+ let Changeset { diffs, .. } = Changeset::new(first, second, "\n");
let mut output = String::new();
@@ -31,14 +31,14 @@ pub fn diff(first: &str, second: &str) -> String {
Difference::Add(ref text) => {
output.push_str("<div class=addition>");
if i == 0 {
- output.push_str(&html_escape(text).replace("\n", "<br>"));
+ output.push_str(&html_escape(text).replace('\n', "<br>"));
} else {
match diffs.get(i - 1) {
Some(Difference::Rem(ref rem)) => {
word_diff(&mut output, rem, text, "ins");
}
_ => {
- output.push_str(&html_escape(text).replace("\n", "<br>"));
+ output.push_str(&html_escape(text).replace('\n', "<br>"));
}
}
}
@@ -51,7 +51,7 @@ pub fn diff(first: &str, second: &str) -> String {
word_diff(&mut output, add, text, "del");
}
_ => {
- output.push_str(&html_escape(text).replace("\n", "<br>"));
+ output.push_str(&html_escape(text).replace('\n', "<br>"));
}
}
output.push_str("\n</div>");
@@ -68,7 +68,7 @@ fn word_diff(out: &mut String, text1: &str, text2: &str, tagname: &str) {
for c in diffs {
match c {
Difference::Same(ref z) => {
- out.push_str(&html_escape(z).replace("\n", "<br>"));
+ out.push_str(&html_escape(z).replace('\n', "<br>"));
out.push(' ');
}
Difference::Add(ref z) => {
@@ -76,7 +76,7 @@ fn word_diff(out: &mut String, text1: &str, text2: &str, tagname: &str) {
out,
"<{0}>{1}</{0}> ",
tagname,
- html_escape(z).replace("\n", "<br>")
+ html_escape(z).replace('\n', "<br>")
)
.expect("write error");
}