Skip to content

Commit 5f34304

Browse files
committed
Add url check to reduce false positives
1 parent 7ff55f3 commit 5f34304

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

clippy_lints/src/doc/broken_link.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,23 @@ fn warn_if_broken_link(cx: &LateContext<'_>, bl: &PullDownBrokenLink<'_>, doc: &
5151
},
5252
};
5353

54+
if raw_link.starts_with("(http") {
55+
// reduce chances of false positive reports
56+
// by limiting this checking only to http/https links.
57+
return;
58+
}
59+
5460
for c in raw_link.chars() {
5561
if c == ')' {
5662
// it is a valid link
5763
return;
5864
}
5965

6066
if c == '\n' {
61-
// detected break line within the url part
6267
report_broken_link(cx, span, len, BrokenLinkReason::MultipleLines);
6368
break;
6469
}
70+
6571
len += 1;
6672
}
6773
}

0 commit comments

Comments
 (0)