Skip to content

Commit b7c542f

Browse files
authored
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 93c3ff6 + 502e707 commit b7c542f

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
@@ -668,9 +668,13 @@ fn render_difference(diff: &html_diff::Difference) {
668668
elem.path, elem.element_name, elem_attributes, opposite_elem_attributes);
669669
}
670670
html_diff::Difference::NodeText { ref elem, ref elem_text, ref opposite_elem_text, .. } => {
671-
let (s1, s2) = concise_compared_strs(elem_text, opposite_elem_text);
672-
println!(" {} Text differs:\n expected: `{}`\n found: `{}`",
673-
elem.path, s1, s2);
671+
if elem_text.split("\n")
672+
.zip(opposite_elem_text.split("\n"))
673+
.any(|(a, b)| a.trim() != b.trim()) {
674+
let (s1, s2) = concise_compared_strs(elem_text, opposite_elem_text);
675+
println!(" {} Text differs:\n expected: `{}`\n found: `{}`",
676+
elem.path, s1, s2);
677+
}
674678
}
675679
html_diff::Difference::NotPresent { ref elem, ref opposite_elem } => {
676680
if let Some(ref elem) = *elem {

0 commit comments

Comments
 (0)