Skip to content

Commit c4aadbd

Browse files
Rollup merge of rust-lang#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
2 parents b475b0a + 502e707 commit c4aadbd

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/librustdoc/html/render.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -660,9 +660,13 @@ fn render_difference(diff: &html_diff::Difference) {
660660
elem.path, elem.element_name, elem_attributes, opposite_elem_attributes);
661661
}
662662
html_diff::Difference::NodeText { ref elem, ref elem_text, ref opposite_elem_text, .. } => {
663-
let (s1, s2) = concise_compared_strs(elem_text, opposite_elem_text);
664-
println!(" {} Text differs:\n expected: `{}`\n found: `{}`",
665-
elem.path, s1, s2);
663+
if elem_text.split("\n")
664+
.zip(opposite_elem_text.split("\n"))
665+
.any(|(a, b)| a.trim() != b.trim()) {
666+
let (s1, s2) = concise_compared_strs(elem_text, opposite_elem_text);
667+
println!(" {} Text differs:\n expected: `{}`\n found: `{}`",
668+
elem.path, s1, s2);
669+
}
666670
}
667671
html_diff::Difference::NotPresent { ref elem, ref opposite_elem } => {
668672
if let Some(ref elem) = *elem {

0 commit comments

Comments
 (0)