about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2017-09-10 14:03:23 +0200
committerGitHub <noreply@github.com>2017-09-10 14:03:23 +0200
commit65fd1a20b05e17b3880caba45920507b6d64d796 (patch)
tree8c595ce7a65e08fb1f6fc6069ad1df2d31de5995
parent62659ebf6650fd72c7cb242aa19915eb2dfc866d (diff)
parent502e707fa70c845e55f86bf9d840a814d04945a6 (diff)
downloadrust-65fd1a20b05e17b3880caba45920507b6d64d796.tar.gz
rust-65fd1a20b05e17b3880caba45920507b6d64d796.zip
Rollup merge of #44347 - GuillaumeGomez:rustdoc-false-positive, r=QuietMisdreavus
Reduce false positives number in rustdoc html diff

cc @rust-lang/dev-tools
r? @nrc

Very simple trick but should lighten html diff a bit
-rw-r--r--src/librustdoc/html/render.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index 074d8c4b8ee..49d4bd23240 100644
--- a/src/librustdoc/html/render.rs
+++ b/src/librustdoc/html/render.rs
@@ -668,9 +668,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 {