Skip to content

Commit 776fe26

Browse files
committed
Drop reason enum as there is only one reason
1 parent 5f34304 commit 776fe26

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

clippy_lints/src/doc/broken_link.rs

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,13 @@ use super::DOC_BROKEN_LINK;
99
/// Scan and report broken link on documents.
1010
/// It ignores false positives detected by pulldown_cmark, and only
1111
/// warns users when the broken link is consider a URL.
12-
pub fn check(cx: &LateContext<'_>, bl: &PullDownBrokenLink<'_>, doc: &String, fragments: &Vec<DocFragment>) {
13-
warn_if_broken_link(cx, bl, doc, fragments);
14-
}
15-
16-
/// The reason why a link is considered broken.
1712
// NOTE: We don't check these other cases because
1813
// rustdoc itself will check and warn about it:
1914
// - When a link url is broken across multiple lines in the URL path part
2015
// - When a link tag is missing the close parenthesis character at the end.
2116
// - When a link has whitespace within the url link.
22-
enum BrokenLinkReason {
23-
MultipleLines,
17+
pub fn check(cx: &LateContext<'_>, bl: &PullDownBrokenLink<'_>, doc: &String, fragments: &Vec<DocFragment>) {
18+
warn_if_broken_link(cx, bl, doc, fragments);
2419
}
2520

2621
fn warn_if_broken_link(cx: &LateContext<'_>, bl: &PullDownBrokenLink<'_>, doc: &String, fragments: &Vec<DocFragment>) {
@@ -64,7 +59,7 @@ fn warn_if_broken_link(cx: &LateContext<'_>, bl: &PullDownBrokenLink<'_>, doc: &
6459
}
6560

6661
if c == '\n' {
67-
report_broken_link(cx, span, len, BrokenLinkReason::MultipleLines);
62+
report_broken_link(cx, span, len);
6863
break;
6964
}
7065

@@ -73,20 +68,16 @@ fn warn_if_broken_link(cx: &LateContext<'_>, bl: &PullDownBrokenLink<'_>, doc: &
7368
}
7469
}
7570

76-
fn report_broken_link(cx: &LateContext<'_>, frag_span: Span, offset: usize, reason: BrokenLinkReason) {
71+
fn report_broken_link(cx: &LateContext<'_>, frag_span: Span, offset: usize) {
7772
let start = frag_span.lo();
7873
let end = start + BytePos::from_usize(offset);
7974

8075
let span = Span::new(start, end, frag_span.ctxt(), frag_span.parent());
8176

82-
let reason_msg = match reason {
83-
BrokenLinkReason::MultipleLines => "broken across multiple lines",
84-
};
85-
8677
span_lint(
8778
cx,
8879
DOC_BROKEN_LINK,
8980
span,
90-
format!("possible broken doc link: {reason_msg}"),
81+
"possible broken doc link: broken across multiple lines",
9182
);
9283
}

0 commit comments

Comments
 (0)