Skip to content

Commit

Permalink
Reduce false positives number in rustdoc html diff
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Sep 6, 2017
1 parent 2f1ef9e commit 502e707
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/librustdoc/html/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -660,9 +660,13 @@ fn render_difference(diff: &html_diff::Difference) {
elem.path, elem.element_name, elem_attributes, opposite_elem_attributes);
}
html_diff::Difference::NodeText { ref elem, ref elem_text, ref opposite_elem_text, .. } => {
let (s1, s2) = concise_compared_strs(elem_text, opposite_elem_text);
println!(" {} Text differs:\n expected: `{}`\n found: `{}`",
elem.path, s1, s2);
if elem_text.split("\n")
.zip(opposite_elem_text.split("\n"))
.any(|(a, b)| a.trim() != b.trim()) {
let (s1, s2) = concise_compared_strs(elem_text, opposite_elem_text);
println!(" {} Text differs:\n expected: `{}`\n found: `{}`",
elem.path, s1, s2);
}
}
html_diff::Difference::NotPresent { ref elem, ref opposite_elem } => {
if let Some(ref elem) = *elem {
Expand Down

0 comments on commit 502e707

Please sign in to comment.