Skip to content

Commit dbbbdf1

Browse files
committed
Add explanatory note to bare_urls lint
I think the lint is confusing otherwise since it doesn't fully explain what the problem is.
1 parent 11d0528 commit dbbbdf1

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

src/librustdoc/passes/bare_urls.rs

+1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ impl<'a, 'tcx> DocFolder for BareUrlsLinter<'a, 'tcx> {
7373
.unwrap_or(item.span.inner());
7474
cx.tcx.struct_span_lint_hir(crate::lint::BARE_URLS, hir_id, sp, |lint| {
7575
lint.build(msg)
76+
.note("bare URLs are not automatically turned into clickable links")
7677
.span_suggestion(
7778
sp,
7879
"use an automatic link instead",

src/test/rustdoc-ui/bare-urls.stderr

+33
Original file line numberDiff line numberDiff line change
@@ -9,102 +9,135 @@ note: the lint level is defined here
99
|
1010
LL | #![deny(rustdoc::bare_urls)]
1111
| ^^^^^^^^^^^^^^^^^^
12+
= note: bare URLs are not automatically turned into clickable links
1213

1314
error: this URL is not a hyperlink
1415
--> $DIR/bare-urls.rs:7:5
1516
|
1617
LL | /// https://somewhere.com/a
1718
| ^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<https://somewhere.com/a>`
19+
|
20+
= note: bare URLs are not automatically turned into clickable links
1821

1922
error: this URL is not a hyperlink
2023
--> $DIR/bare-urls.rs:9:5
2124
|
2225
LL | /// https://www.somewhere.com
2326
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<https://www.somewhere.com>`
27+
|
28+
= note: bare URLs are not automatically turned into clickable links
2429

2530
error: this URL is not a hyperlink
2631
--> $DIR/bare-urls.rs:11:5
2732
|
2833
LL | /// https://www.somewhere.com/a
2934
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<https://www.somewhere.com/a>`
35+
|
36+
= note: bare URLs are not automatically turned into clickable links
3037

3138
error: this URL is not a hyperlink
3239
--> $DIR/bare-urls.rs:13:5
3340
|
3441
LL | /// https://subdomain.example.com
3542
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<https://subdomain.example.com>`
43+
|
44+
= note: bare URLs are not automatically turned into clickable links
3645

3746
error: this URL is not a hyperlink
3847
--> $DIR/bare-urls.rs:15:5
3948
|
4049
LL | /// https://somewhere.com?
4150
| ^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<https://somewhere.com?>`
51+
|
52+
= note: bare URLs are not automatically turned into clickable links
4253

4354
error: this URL is not a hyperlink
4455
--> $DIR/bare-urls.rs:17:5
4556
|
4657
LL | /// https://somewhere.com/a?
4758
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<https://somewhere.com/a?>`
59+
|
60+
= note: bare URLs are not automatically turned into clickable links
4861

4962
error: this URL is not a hyperlink
5063
--> $DIR/bare-urls.rs:19:5
5164
|
5265
LL | /// https://somewhere.com?hello=12
5366
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<https://somewhere.com?hello=12>`
67+
|
68+
= note: bare URLs are not automatically turned into clickable links
5469

5570
error: this URL is not a hyperlink
5671
--> $DIR/bare-urls.rs:21:5
5772
|
5873
LL | /// https://somewhere.com/a?hello=12
5974
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<https://somewhere.com/a?hello=12>`
75+
|
76+
= note: bare URLs are not automatically turned into clickable links
6077

6178
error: this URL is not a hyperlink
6279
--> $DIR/bare-urls.rs:23:5
6380
|
6481
LL | /// https://example.com?hello=12#xyz
6582
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<https://example.com?hello=12#xyz>`
83+
|
84+
= note: bare URLs are not automatically turned into clickable links
6685

6786
error: this URL is not a hyperlink
6887
--> $DIR/bare-urls.rs:25:5
6988
|
7089
LL | /// https://example.com/a?hello=12#xyz
7190
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<https://example.com/a?hello=12#xyz>`
91+
|
92+
= note: bare URLs are not automatically turned into clickable links
7293

7394
error: this URL is not a hyperlink
7495
--> $DIR/bare-urls.rs:27:5
7596
|
7697
LL | /// https://example.com#xyz
7798
| ^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<https://example.com#xyz>`
99+
|
100+
= note: bare URLs are not automatically turned into clickable links
78101

79102
error: this URL is not a hyperlink
80103
--> $DIR/bare-urls.rs:29:5
81104
|
82105
LL | /// https://example.com/a#xyz
83106
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<https://example.com/a#xyz>`
107+
|
108+
= note: bare URLs are not automatically turned into clickable links
84109

85110
error: this URL is not a hyperlink
86111
--> $DIR/bare-urls.rs:31:5
87112
|
88113
LL | /// https://somewhere.com?hello=12&bye=11
89114
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<https://somewhere.com?hello=12&bye=11>`
115+
|
116+
= note: bare URLs are not automatically turned into clickable links
90117

91118
error: this URL is not a hyperlink
92119
--> $DIR/bare-urls.rs:33:5
93120
|
94121
LL | /// https://somewhere.com/a?hello=12&bye=11
95122
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<https://somewhere.com/a?hello=12&bye=11>`
123+
|
124+
= note: bare URLs are not automatically turned into clickable links
96125

97126
error: this URL is not a hyperlink
98127
--> $DIR/bare-urls.rs:35:5
99128
|
100129
LL | /// https://somewhere.com?hello=12&bye=11#xyz
101130
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<https://somewhere.com?hello=12&bye=11#xyz>`
131+
|
132+
= note: bare URLs are not automatically turned into clickable links
102133

103134
error: this URL is not a hyperlink
104135
--> $DIR/bare-urls.rs:37:10
105136
|
106137
LL | /// hey! https://somewhere.com/a?hello=12&bye=11#xyz
107138
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<https://somewhere.com/a?hello=12&bye=11#xyz>`
139+
|
140+
= note: bare URLs are not automatically turned into clickable links
108141

109142
error: aborting due to 17 previous errors
110143

src/test/rustdoc-ui/renamed-lint-still-applies.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ note: the lint level is defined here
3131
|
3232
LL | #![deny(rustdoc::non_autolinks)]
3333
| ^^^^^^^^^^^^^^^^^^^^^^
34+
= note: bare URLs are not automatically turned into clickable links
3435

3536
error: aborting due to 2 previous errors; 1 warning emitted
3637

0 commit comments

Comments
 (0)