diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2020-10-12 18:29:56 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2020-11-05 10:22:08 +0100 |
| commit | 6bc8965c418e90c135ee90554108bd0bdbe0a8d8 (patch) | |
| tree | c9deb42a4b081adafd584f4c59cc87937542a49c | |
| parent | a54f04373382b085837f5f835569d238bf6049e1 (diff) | |
| download | rust-6bc8965c418e90c135ee90554108bd0bdbe0a8d8.tar.gz rust-6bc8965c418e90c135ee90554108bd0bdbe0a8d8.zip | |
Add tests for automatic_links lint
| -rw-r--r-- | src/test/rustdoc-ui/automatic-links.rs | 17 | ||||
| -rw-r--r-- | src/test/rustdoc-ui/automatic-links.stderr | 23 |
2 files changed, 40 insertions, 0 deletions
diff --git a/src/test/rustdoc-ui/automatic-links.rs b/src/test/rustdoc-ui/automatic-links.rs new file mode 100644 index 00000000000..9273b854aee --- /dev/null +++ b/src/test/rustdoc-ui/automatic-links.rs @@ -0,0 +1,17 @@ +#![deny(automatic_links)] + +/// [http://a.com](http://a.com) +//~^ ERROR Unneeded long form for URL +/// [http://b.com] +//~^ ERROR Unneeded long form for URL +/// +/// [http://b.com]: http://b.com +/// +/// [http://c.com][http://c.com] +pub fn a() {} + +/// [a](http://a.com) +/// [b] +/// +/// [b]: http://b.com +pub fn everything_is_fine_here() {} diff --git a/src/test/rustdoc-ui/automatic-links.stderr b/src/test/rustdoc-ui/automatic-links.stderr new file mode 100644 index 00000000000..2922fedb238 --- /dev/null +++ b/src/test/rustdoc-ui/automatic-links.stderr @@ -0,0 +1,23 @@ +error: Unneeded long form for URL + --> $DIR/automatic-links.rs:3:5 + | +LL | /// [http://a.com](http://a.com) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/automatic-links.rs:1:9 + | +LL | #![deny(automatic_links)] + | ^^^^^^^^^^^^^^^ + = help: Try with `<http://a.com>` instead + +error: Unneeded long form for URL + --> $DIR/automatic-links.rs:5:5 + | +LL | /// [http://b.com] + | ^^^^^^^^^^^^^^ + | + = help: Try with `<http://b.com>` instead + +error: aborting due to 2 previous errors + |
