@@ -9,18 +9,13 @@ use super::DOC_BROKEN_LINK;
9
9
/// Scan and report broken link on documents.
10
10
/// It ignores false positives detected by pulldown_cmark, and only
11
11
/// 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.
17
12
// NOTE: We don't check these other cases because
18
13
// rustdoc itself will check and warn about it:
19
14
// - When a link url is broken across multiple lines in the URL path part
20
15
// - When a link tag is missing the close parenthesis character at the end.
21
16
// - 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 ) ;
24
19
}
25
20
26
21
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: &
64
59
}
65
60
66
61
if c == '\n' {
67
- report_broken_link ( cx, span, len, BrokenLinkReason :: MultipleLines ) ;
62
+ report_broken_link ( cx, span, len) ;
68
63
break ;
69
64
}
70
65
@@ -73,20 +68,16 @@ fn warn_if_broken_link(cx: &LateContext<'_>, bl: &PullDownBrokenLink<'_>, doc: &
73
68
}
74
69
}
75
70
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 ) {
77
72
let start = frag_span. lo ( ) ;
78
73
let end = start + BytePos :: from_usize ( offset) ;
79
74
80
75
let span = Span :: new ( start, end, frag_span. ctxt ( ) , frag_span. parent ( ) ) ;
81
76
82
- let reason_msg = match reason {
83
- BrokenLinkReason :: MultipleLines => "broken across multiple lines" ,
84
- } ;
85
-
86
77
span_lint (
87
78
cx,
88
79
DOC_BROKEN_LINK ,
89
80
span,
90
- format ! ( "possible broken doc link: {reason_msg}" ) ,
81
+ "possible broken doc link: broken across multiple lines" ,
91
82
) ;
92
83
}
0 commit comments