diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2017-09-05 20:54:01 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2017-09-06 10:05:33 +0200 |
| commit | 502e707fa70c845e55f86bf9d840a814d04945a6 (patch) | |
| tree | 80184c291b0d694d3252b3c218729898c5a351b9 | |
| parent | 2f1ef9ef1181298d46e79d5dde6bafeb6483926f (diff) | |
| download | rust-502e707fa70c845e55f86bf9d840a814d04945a6.tar.gz rust-502e707fa70c845e55f86bf9d840a814d04945a6.zip | |
Reduce false positives number in rustdoc html diff
| -rw-r--r-- | src/librustdoc/html/render.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index cc84e340c74..7e0e1e5b416 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -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 { |
