Skip to content

Commit aabc363

Browse files
committed
Run rustfix for bare-urls test
This will help us ensure that it emits valid suggestions.
1 parent d931e2b commit aabc363

File tree

3 files changed

+80
-18
lines changed

3 files changed

+80
-18
lines changed

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

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// run-rustfix
2+
3+
#![deny(rustdoc::bare_urls)]
4+
5+
/// <https://somewhere.com>
6+
//~^ ERROR this URL is not a hyperlink
7+
/// <https://somewhere.com/a>
8+
//~^ ERROR this URL is not a hyperlink
9+
/// <https://www.somewhere.com>
10+
//~^ ERROR this URL is not a hyperlink
11+
/// <https://www.somewhere.com/a>
12+
//~^ ERROR this URL is not a hyperlink
13+
/// <https://subdomain.example.com>
14+
//~^ ERROR not a hyperlink
15+
/// <https://somewhere.com?>
16+
//~^ ERROR this URL is not a hyperlink
17+
/// <https://somewhere.com/a?>
18+
//~^ ERROR this URL is not a hyperlink
19+
/// <https://somewhere.com?hello=12>
20+
//~^ ERROR this URL is not a hyperlink
21+
/// <https://somewhere.com/a?hello=12>
22+
//~^ ERROR this URL is not a hyperlink
23+
/// <https://example.com?hello=12#xyz>
24+
//~^ ERROR this URL is not a hyperlink
25+
/// <https://example.com/a?hello=12#xyz>
26+
//~^ ERROR this URL is not a hyperlink
27+
/// <https://example.com#xyz>
28+
//~^ ERROR this URL is not a hyperlink
29+
/// <https://example.com/a#xyz>
30+
//~^ ERROR this URL is not a hyperlink
31+
/// <https://somewhere.com?hello=12&bye=11>
32+
//~^ ERROR this URL is not a hyperlink
33+
/// <https://somewhere.com/a?hello=12&bye=11>
34+
//~^ ERROR this URL is not a hyperlink
35+
/// <https://somewhere.com?hello=12&bye=11#xyz>
36+
//~^ ERROR this URL is not a hyperlink
37+
/// hey! <https://somewhere.com/a?hello=12&bye=11#xyz>
38+
//~^ ERROR this URL is not a hyperlink
39+
pub fn c() {}
40+
41+
/// <https://somewhere.com>
42+
/// [a](http://a.com)
43+
/// [b]
44+
///
45+
/// [b]: http://b.com
46+
///
47+
/// ```
48+
/// This link should not be linted: http://example.com
49+
///
50+
/// Nor this one: <http://example.com> or this one: [x](http://example.com)
51+
/// ```
52+
///
53+
/// [should_not.lint](should_not.lint)
54+
pub fn everything_is_fine_here() {}
55+
56+
#[allow(rustdoc::bare_urls)]
57+
pub mod foo {
58+
/// https://somewhere.com/a?hello=12&bye=11#xyz
59+
pub fn bar() {}
60+
}

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

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// run-rustfix
2+
13
#![deny(rustdoc::bare_urls)]
24

35
/// https://somewhere.com

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

+18-18
Original file line numberDiff line numberDiff line change
@@ -1,107 +1,107 @@
11
error: this URL is not a hyperlink
2-
--> $DIR/bare-urls.rs:3:5
2+
--> $DIR/bare-urls.rs:5:5
33
|
44
LL | /// https://somewhere.com
55
| ^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<https://somewhere.com>`
66
|
77
note: the lint level is defined here
8-
--> $DIR/bare-urls.rs:1:9
8+
--> $DIR/bare-urls.rs:3:9
99
|
1010
LL | #![deny(rustdoc::bare_urls)]
1111
| ^^^^^^^^^^^^^^^^^^
1212

1313
error: this URL is not a hyperlink
14-
--> $DIR/bare-urls.rs:5:5
14+
--> $DIR/bare-urls.rs:7:5
1515
|
1616
LL | /// https://somewhere.com/a
1717
| ^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<https://somewhere.com/a>`
1818

1919
error: this URL is not a hyperlink
20-
--> $DIR/bare-urls.rs:7:5
20+
--> $DIR/bare-urls.rs:9:5
2121
|
2222
LL | /// https://www.somewhere.com
2323
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<https://www.somewhere.com>`
2424

2525
error: this URL is not a hyperlink
26-
--> $DIR/bare-urls.rs:9:5
26+
--> $DIR/bare-urls.rs:11:5
2727
|
2828
LL | /// https://www.somewhere.com/a
2929
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<https://www.somewhere.com/a>`
3030

3131
error: this URL is not a hyperlink
32-
--> $DIR/bare-urls.rs:11:5
32+
--> $DIR/bare-urls.rs:13:5
3333
|
3434
LL | /// https://subdomain.example.com
3535
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<https://subdomain.example.com>`
3636

3737
error: this URL is not a hyperlink
38-
--> $DIR/bare-urls.rs:13:5
38+
--> $DIR/bare-urls.rs:15:5
3939
|
4040
LL | /// https://somewhere.com?
4141
| ^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<https://somewhere.com?>`
4242

4343
error: this URL is not a hyperlink
44-
--> $DIR/bare-urls.rs:15:5
44+
--> $DIR/bare-urls.rs:17:5
4545
|
4646
LL | /// https://somewhere.com/a?
4747
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<https://somewhere.com/a?>`
4848

4949
error: this URL is not a hyperlink
50-
--> $DIR/bare-urls.rs:17:5
50+
--> $DIR/bare-urls.rs:19:5
5151
|
5252
LL | /// https://somewhere.com?hello=12
5353
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<https://somewhere.com?hello=12>`
5454

5555
error: this URL is not a hyperlink
56-
--> $DIR/bare-urls.rs:19:5
56+
--> $DIR/bare-urls.rs:21:5
5757
|
5858
LL | /// https://somewhere.com/a?hello=12
5959
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<https://somewhere.com/a?hello=12>`
6060

6161
error: this URL is not a hyperlink
62-
--> $DIR/bare-urls.rs:21:5
62+
--> $DIR/bare-urls.rs:23:5
6363
|
6464
LL | /// https://example.com?hello=12#xyz
6565
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<https://example.com?hello=12#xyz>`
6666

6767
error: this URL is not a hyperlink
68-
--> $DIR/bare-urls.rs:23:5
68+
--> $DIR/bare-urls.rs:25:5
6969
|
7070
LL | /// https://example.com/a?hello=12#xyz
7171
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<https://example.com/a?hello=12#xyz>`
7272

7373
error: this URL is not a hyperlink
74-
--> $DIR/bare-urls.rs:25:5
74+
--> $DIR/bare-urls.rs:27:5
7575
|
7676
LL | /// https://example.com#xyz
7777
| ^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<https://example.com#xyz>`
7878

7979
error: this URL is not a hyperlink
80-
--> $DIR/bare-urls.rs:27:5
80+
--> $DIR/bare-urls.rs:29:5
8181
|
8282
LL | /// https://example.com/a#xyz
8383
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<https://example.com/a#xyz>`
8484

8585
error: this URL is not a hyperlink
86-
--> $DIR/bare-urls.rs:29:5
86+
--> $DIR/bare-urls.rs:31:5
8787
|
8888
LL | /// https://somewhere.com?hello=12&bye=11
8989
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<https://somewhere.com?hello=12&bye=11>`
9090

9191
error: this URL is not a hyperlink
92-
--> $DIR/bare-urls.rs:31:5
92+
--> $DIR/bare-urls.rs:33:5
9393
|
9494
LL | /// https://somewhere.com/a?hello=12&bye=11
9595
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<https://somewhere.com/a?hello=12&bye=11>`
9696

9797
error: this URL is not a hyperlink
98-
--> $DIR/bare-urls.rs:33:5
98+
--> $DIR/bare-urls.rs:35:5
9999
|
100100
LL | /// https://somewhere.com?hello=12&bye=11#xyz
101101
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<https://somewhere.com?hello=12&bye=11#xyz>`
102102

103103
error: this URL is not a hyperlink
104-
--> $DIR/bare-urls.rs:35:10
104+
--> $DIR/bare-urls.rs:37:10
105105
|
106106
LL | /// hey! https://somewhere.com/a?hello=12&bye=11#xyz
107107
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<https://somewhere.com/a?hello=12&bye=11#xyz>`

0 commit comments

Comments
 (0)