From d931e2b7bfd74caeb1e25128e4382ba706d4ec52 Mon Sep 17 00:00:00 2001 From: Camelid Date: Thu, 8 Apr 2021 16:06:10 -0700 Subject: Rename `url-improvements` test to `bare-urls` The lint used to be called `non-autolinks`, and linted more than just bare URLs. Now, it is called `bare-urls` and only lints against bare URLs. So, `bare-urls` is a better name for the test. --- src/test/rustdoc-ui/bare-urls.rs | 58 +++++++++++++++ src/test/rustdoc-ui/bare-urls.stderr | 110 ++++++++++++++++++++++++++++ src/test/rustdoc-ui/url-improvements.rs | 58 --------------- src/test/rustdoc-ui/url-improvements.stderr | 110 ---------------------------- 4 files changed, 168 insertions(+), 168 deletions(-) create mode 100644 src/test/rustdoc-ui/bare-urls.rs create mode 100644 src/test/rustdoc-ui/bare-urls.stderr delete mode 100644 src/test/rustdoc-ui/url-improvements.rs delete mode 100644 src/test/rustdoc-ui/url-improvements.stderr diff --git a/src/test/rustdoc-ui/bare-urls.rs b/src/test/rustdoc-ui/bare-urls.rs new file mode 100644 index 00000000000..43a13b02d0a --- /dev/null +++ b/src/test/rustdoc-ui/bare-urls.rs @@ -0,0 +1,58 @@ +#![deny(rustdoc::bare_urls)] + +/// https://somewhere.com +//~^ ERROR this URL is not a hyperlink +/// https://somewhere.com/a +//~^ ERROR this URL is not a hyperlink +/// https://www.somewhere.com +//~^ ERROR this URL is not a hyperlink +/// https://www.somewhere.com/a +//~^ ERROR this URL is not a hyperlink +/// https://subdomain.example.com +//~^ ERROR not a hyperlink +/// https://somewhere.com? +//~^ ERROR this URL is not a hyperlink +/// https://somewhere.com/a? +//~^ ERROR this URL is not a hyperlink +/// https://somewhere.com?hello=12 +//~^ ERROR this URL is not a hyperlink +/// https://somewhere.com/a?hello=12 +//~^ ERROR this URL is not a hyperlink +/// https://example.com?hello=12#xyz +//~^ ERROR this URL is not a hyperlink +/// https://example.com/a?hello=12#xyz +//~^ ERROR this URL is not a hyperlink +/// https://example.com#xyz +//~^ ERROR this URL is not a hyperlink +/// https://example.com/a#xyz +//~^ ERROR this URL is not a hyperlink +/// https://somewhere.com?hello=12&bye=11 +//~^ ERROR this URL is not a hyperlink +/// https://somewhere.com/a?hello=12&bye=11 +//~^ ERROR this URL is not a hyperlink +/// https://somewhere.com?hello=12&bye=11#xyz +//~^ ERROR this URL is not a hyperlink +/// hey! https://somewhere.com/a?hello=12&bye=11#xyz +//~^ ERROR this URL is not a hyperlink +pub fn c() {} + +/// +/// [a](http://a.com) +/// [b] +/// +/// [b]: http://b.com +/// +/// ``` +/// This link should not be linted: http://example.com +/// +/// Nor this one: or this one: [x](http://example.com) +/// ``` +/// +/// [should_not.lint](should_not.lint) +pub fn everything_is_fine_here() {} + +#[allow(rustdoc::bare_urls)] +pub mod foo { + /// https://somewhere.com/a?hello=12&bye=11#xyz + pub fn bar() {} +} diff --git a/src/test/rustdoc-ui/bare-urls.stderr b/src/test/rustdoc-ui/bare-urls.stderr new file mode 100644 index 00000000000..a4c06bbd5a5 --- /dev/null +++ b/src/test/rustdoc-ui/bare-urls.stderr @@ -0,0 +1,110 @@ +error: this URL is not a hyperlink + --> $DIR/bare-urls.rs:3:5 + | +LL | /// https://somewhere.com + | ^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` + | +note: the lint level is defined here + --> $DIR/bare-urls.rs:1:9 + | +LL | #![deny(rustdoc::bare_urls)] + | ^^^^^^^^^^^^^^^^^^ + +error: this URL is not a hyperlink + --> $DIR/bare-urls.rs:5:5 + | +LL | /// https://somewhere.com/a + | ^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` + +error: this URL is not a hyperlink + --> $DIR/bare-urls.rs:7:5 + | +LL | /// https://www.somewhere.com + | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` + +error: this URL is not a hyperlink + --> $DIR/bare-urls.rs:9:5 + | +LL | /// https://www.somewhere.com/a + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` + +error: this URL is not a hyperlink + --> $DIR/bare-urls.rs:11:5 + | +LL | /// https://subdomain.example.com + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` + +error: this URL is not a hyperlink + --> $DIR/bare-urls.rs:13:5 + | +LL | /// https://somewhere.com? + | ^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` + +error: this URL is not a hyperlink + --> $DIR/bare-urls.rs:15:5 + | +LL | /// https://somewhere.com/a? + | ^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` + +error: this URL is not a hyperlink + --> $DIR/bare-urls.rs:17:5 + | +LL | /// https://somewhere.com?hello=12 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` + +error: this URL is not a hyperlink + --> $DIR/bare-urls.rs:19:5 + | +LL | /// https://somewhere.com/a?hello=12 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` + +error: this URL is not a hyperlink + --> $DIR/bare-urls.rs:21:5 + | +LL | /// https://example.com?hello=12#xyz + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` + +error: this URL is not a hyperlink + --> $DIR/bare-urls.rs:23:5 + | +LL | /// https://example.com/a?hello=12#xyz + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` + +error: this URL is not a hyperlink + --> $DIR/bare-urls.rs:25:5 + | +LL | /// https://example.com#xyz + | ^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` + +error: this URL is not a hyperlink + --> $DIR/bare-urls.rs:27:5 + | +LL | /// https://example.com/a#xyz + | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` + +error: this URL is not a hyperlink + --> $DIR/bare-urls.rs:29:5 + | +LL | /// https://somewhere.com?hello=12&bye=11 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` + +error: this URL is not a hyperlink + --> $DIR/bare-urls.rs:31:5 + | +LL | /// https://somewhere.com/a?hello=12&bye=11 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` + +error: this URL is not a hyperlink + --> $DIR/bare-urls.rs:33:5 + | +LL | /// https://somewhere.com?hello=12&bye=11#xyz + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` + +error: this URL is not a hyperlink + --> $DIR/bare-urls.rs:35:10 + | +LL | /// hey! https://somewhere.com/a?hello=12&bye=11#xyz + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` + +error: aborting due to 17 previous errors + diff --git a/src/test/rustdoc-ui/url-improvements.rs b/src/test/rustdoc-ui/url-improvements.rs deleted file mode 100644 index 43a13b02d0a..00000000000 --- a/src/test/rustdoc-ui/url-improvements.rs +++ /dev/null @@ -1,58 +0,0 @@ -#![deny(rustdoc::bare_urls)] - -/// https://somewhere.com -//~^ ERROR this URL is not a hyperlink -/// https://somewhere.com/a -//~^ ERROR this URL is not a hyperlink -/// https://www.somewhere.com -//~^ ERROR this URL is not a hyperlink -/// https://www.somewhere.com/a -//~^ ERROR this URL is not a hyperlink -/// https://subdomain.example.com -//~^ ERROR not a hyperlink -/// https://somewhere.com? -//~^ ERROR this URL is not a hyperlink -/// https://somewhere.com/a? -//~^ ERROR this URL is not a hyperlink -/// https://somewhere.com?hello=12 -//~^ ERROR this URL is not a hyperlink -/// https://somewhere.com/a?hello=12 -//~^ ERROR this URL is not a hyperlink -/// https://example.com?hello=12#xyz -//~^ ERROR this URL is not a hyperlink -/// https://example.com/a?hello=12#xyz -//~^ ERROR this URL is not a hyperlink -/// https://example.com#xyz -//~^ ERROR this URL is not a hyperlink -/// https://example.com/a#xyz -//~^ ERROR this URL is not a hyperlink -/// https://somewhere.com?hello=12&bye=11 -//~^ ERROR this URL is not a hyperlink -/// https://somewhere.com/a?hello=12&bye=11 -//~^ ERROR this URL is not a hyperlink -/// https://somewhere.com?hello=12&bye=11#xyz -//~^ ERROR this URL is not a hyperlink -/// hey! https://somewhere.com/a?hello=12&bye=11#xyz -//~^ ERROR this URL is not a hyperlink -pub fn c() {} - -/// -/// [a](http://a.com) -/// [b] -/// -/// [b]: http://b.com -/// -/// ``` -/// This link should not be linted: http://example.com -/// -/// Nor this one: or this one: [x](http://example.com) -/// ``` -/// -/// [should_not.lint](should_not.lint) -pub fn everything_is_fine_here() {} - -#[allow(rustdoc::bare_urls)] -pub mod foo { - /// https://somewhere.com/a?hello=12&bye=11#xyz - pub fn bar() {} -} diff --git a/src/test/rustdoc-ui/url-improvements.stderr b/src/test/rustdoc-ui/url-improvements.stderr deleted file mode 100644 index 3d5ebd8be6b..00000000000 --- a/src/test/rustdoc-ui/url-improvements.stderr +++ /dev/null @@ -1,110 +0,0 @@ -error: this URL is not a hyperlink - --> $DIR/url-improvements.rs:3:5 - | -LL | /// https://somewhere.com - | ^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` - | -note: the lint level is defined here - --> $DIR/url-improvements.rs:1:9 - | -LL | #![deny(rustdoc::bare_urls)] - | ^^^^^^^^^^^^^^^^^^ - -error: this URL is not a hyperlink - --> $DIR/url-improvements.rs:5:5 - | -LL | /// https://somewhere.com/a - | ^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` - -error: this URL is not a hyperlink - --> $DIR/url-improvements.rs:7:5 - | -LL | /// https://www.somewhere.com - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` - -error: this URL is not a hyperlink - --> $DIR/url-improvements.rs:9:5 - | -LL | /// https://www.somewhere.com/a - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` - -error: this URL is not a hyperlink - --> $DIR/url-improvements.rs:11:5 - | -LL | /// https://subdomain.example.com - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` - -error: this URL is not a hyperlink - --> $DIR/url-improvements.rs:13:5 - | -LL | /// https://somewhere.com? - | ^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` - -error: this URL is not a hyperlink - --> $DIR/url-improvements.rs:15:5 - | -LL | /// https://somewhere.com/a? - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` - -error: this URL is not a hyperlink - --> $DIR/url-improvements.rs:17:5 - | -LL | /// https://somewhere.com?hello=12 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` - -error: this URL is not a hyperlink - --> $DIR/url-improvements.rs:19:5 - | -LL | /// https://somewhere.com/a?hello=12 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` - -error: this URL is not a hyperlink - --> $DIR/url-improvements.rs:21:5 - | -LL | /// https://example.com?hello=12#xyz - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` - -error: this URL is not a hyperlink - --> $DIR/url-improvements.rs:23:5 - | -LL | /// https://example.com/a?hello=12#xyz - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` - -error: this URL is not a hyperlink - --> $DIR/url-improvements.rs:25:5 - | -LL | /// https://example.com#xyz - | ^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` - -error: this URL is not a hyperlink - --> $DIR/url-improvements.rs:27:5 - | -LL | /// https://example.com/a#xyz - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` - -error: this URL is not a hyperlink - --> $DIR/url-improvements.rs:29:5 - | -LL | /// https://somewhere.com?hello=12&bye=11 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` - -error: this URL is not a hyperlink - --> $DIR/url-improvements.rs:31:5 - | -LL | /// https://somewhere.com/a?hello=12&bye=11 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` - -error: this URL is not a hyperlink - --> $DIR/url-improvements.rs:33:5 - | -LL | /// https://somewhere.com?hello=12&bye=11#xyz - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` - -error: this URL is not a hyperlink - --> $DIR/url-improvements.rs:35:10 - | -LL | /// hey! https://somewhere.com/a?hello=12&bye=11#xyz - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` - -error: aborting due to 17 previous errors - -- cgit 1.4.1-3-g733a5 From aabc363bc2c66d1dd31a4f7e4d27cf77303ab6d8 Mon Sep 17 00:00:00 2001 From: Camelid Date: Sat, 10 Apr 2021 18:39:05 -0700 Subject: Run rustfix for `bare-urls` test This will help us ensure that it emits valid suggestions. --- src/test/rustdoc-ui/bare-urls.fixed | 60 ++++++++++++++++++++++++++++++++++++ src/test/rustdoc-ui/bare-urls.rs | 2 ++ src/test/rustdoc-ui/bare-urls.stderr | 36 +++++++++++----------- 3 files changed, 80 insertions(+), 18 deletions(-) create mode 100644 src/test/rustdoc-ui/bare-urls.fixed diff --git a/src/test/rustdoc-ui/bare-urls.fixed b/src/test/rustdoc-ui/bare-urls.fixed new file mode 100644 index 00000000000..23aa5c44c21 --- /dev/null +++ b/src/test/rustdoc-ui/bare-urls.fixed @@ -0,0 +1,60 @@ +// run-rustfix + +#![deny(rustdoc::bare_urls)] + +/// +//~^ ERROR this URL is not a hyperlink +/// +//~^ ERROR this URL is not a hyperlink +/// +//~^ ERROR this URL is not a hyperlink +/// +//~^ ERROR this URL is not a hyperlink +/// +//~^ ERROR not a hyperlink +/// +//~^ ERROR this URL is not a hyperlink +/// +//~^ ERROR this URL is not a hyperlink +/// +//~^ ERROR this URL is not a hyperlink +/// +//~^ ERROR this URL is not a hyperlink +/// +//~^ ERROR this URL is not a hyperlink +/// +//~^ ERROR this URL is not a hyperlink +/// +//~^ ERROR this URL is not a hyperlink +/// +//~^ ERROR this URL is not a hyperlink +/// +//~^ ERROR this URL is not a hyperlink +/// +//~^ ERROR this URL is not a hyperlink +/// +//~^ ERROR this URL is not a hyperlink +/// hey! +//~^ ERROR this URL is not a hyperlink +pub fn c() {} + +/// +/// [a](http://a.com) +/// [b] +/// +/// [b]: http://b.com +/// +/// ``` +/// This link should not be linted: http://example.com +/// +/// Nor this one: or this one: [x](http://example.com) +/// ``` +/// +/// [should_not.lint](should_not.lint) +pub fn everything_is_fine_here() {} + +#[allow(rustdoc::bare_urls)] +pub mod foo { + /// https://somewhere.com/a?hello=12&bye=11#xyz + pub fn bar() {} +} diff --git a/src/test/rustdoc-ui/bare-urls.rs b/src/test/rustdoc-ui/bare-urls.rs index 43a13b02d0a..592f57343bc 100644 --- a/src/test/rustdoc-ui/bare-urls.rs +++ b/src/test/rustdoc-ui/bare-urls.rs @@ -1,3 +1,5 @@ +// run-rustfix + #![deny(rustdoc::bare_urls)] /// https://somewhere.com diff --git a/src/test/rustdoc-ui/bare-urls.stderr b/src/test/rustdoc-ui/bare-urls.stderr index a4c06bbd5a5..6b612f81590 100644 --- a/src/test/rustdoc-ui/bare-urls.stderr +++ b/src/test/rustdoc-ui/bare-urls.stderr @@ -1,107 +1,107 @@ error: this URL is not a hyperlink - --> $DIR/bare-urls.rs:3:5 + --> $DIR/bare-urls.rs:5:5 | LL | /// https://somewhere.com | ^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` | note: the lint level is defined here - --> $DIR/bare-urls.rs:1:9 + --> $DIR/bare-urls.rs:3:9 | LL | #![deny(rustdoc::bare_urls)] | ^^^^^^^^^^^^^^^^^^ error: this URL is not a hyperlink - --> $DIR/bare-urls.rs:5:5 + --> $DIR/bare-urls.rs:7:5 | LL | /// https://somewhere.com/a | ^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` error: this URL is not a hyperlink - --> $DIR/bare-urls.rs:7:5 + --> $DIR/bare-urls.rs:9:5 | LL | /// https://www.somewhere.com | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` error: this URL is not a hyperlink - --> $DIR/bare-urls.rs:9:5 + --> $DIR/bare-urls.rs:11:5 | LL | /// https://www.somewhere.com/a | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` error: this URL is not a hyperlink - --> $DIR/bare-urls.rs:11:5 + --> $DIR/bare-urls.rs:13:5 | LL | /// https://subdomain.example.com | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` error: this URL is not a hyperlink - --> $DIR/bare-urls.rs:13:5 + --> $DIR/bare-urls.rs:15:5 | LL | /// https://somewhere.com? | ^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` error: this URL is not a hyperlink - --> $DIR/bare-urls.rs:15:5 + --> $DIR/bare-urls.rs:17:5 | LL | /// https://somewhere.com/a? | ^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` error: this URL is not a hyperlink - --> $DIR/bare-urls.rs:17:5 + --> $DIR/bare-urls.rs:19:5 | LL | /// https://somewhere.com?hello=12 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` error: this URL is not a hyperlink - --> $DIR/bare-urls.rs:19:5 + --> $DIR/bare-urls.rs:21:5 | LL | /// https://somewhere.com/a?hello=12 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` error: this URL is not a hyperlink - --> $DIR/bare-urls.rs:21:5 + --> $DIR/bare-urls.rs:23:5 | LL | /// https://example.com?hello=12#xyz | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` error: this URL is not a hyperlink - --> $DIR/bare-urls.rs:23:5 + --> $DIR/bare-urls.rs:25:5 | LL | /// https://example.com/a?hello=12#xyz | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` error: this URL is not a hyperlink - --> $DIR/bare-urls.rs:25:5 + --> $DIR/bare-urls.rs:27:5 | LL | /// https://example.com#xyz | ^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` error: this URL is not a hyperlink - --> $DIR/bare-urls.rs:27:5 + --> $DIR/bare-urls.rs:29:5 | LL | /// https://example.com/a#xyz | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` error: this URL is not a hyperlink - --> $DIR/bare-urls.rs:29:5 + --> $DIR/bare-urls.rs:31:5 | LL | /// https://somewhere.com?hello=12&bye=11 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` error: this URL is not a hyperlink - --> $DIR/bare-urls.rs:31:5 + --> $DIR/bare-urls.rs:33:5 | LL | /// https://somewhere.com/a?hello=12&bye=11 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` error: this URL is not a hyperlink - --> $DIR/bare-urls.rs:33:5 + --> $DIR/bare-urls.rs:35:5 | LL | /// https://somewhere.com?hello=12&bye=11#xyz | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` error: this URL is not a hyperlink - --> $DIR/bare-urls.rs:35:10 + --> $DIR/bare-urls.rs:37:10 | LL | /// hey! https://somewhere.com/a?hello=12&bye=11#xyz | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `` -- cgit 1.4.1-3-g733a5