From 6bc8965c418e90c135ee90554108bd0bdbe0a8d8 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 12 Oct 2020 18:29:56 +0200 Subject: [PATCH] Add tests for automatic_links lint --- src/test/rustdoc-ui/automatic-links.rs | 17 ++++++++++++++++ src/test/rustdoc-ui/automatic-links.stderr | 23 ++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 src/test/rustdoc-ui/automatic-links.rs create mode 100644 src/test/rustdoc-ui/automatic-links.stderr diff --git a/src/test/rustdoc-ui/automatic-links.rs b/src/test/rustdoc-ui/automatic-links.rs new file mode 100644 index 000000000000..9273b854aee1 --- /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 000000000000..2922fedb238c --- /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 `` instead + +error: Unneeded long form for URL + --> $DIR/automatic-links.rs:5:5 + | +LL | /// [http://b.com] + | ^^^^^^^^^^^^^^ + | + = help: Try with `` instead + +error: aborting due to 2 previous errors +