Add tests for automatic_links lint

This commit is contained in:
Guillaume Gomez 2020-10-12 18:29:56 +02:00
parent a54f043733
commit 6bc8965c41
2 changed files with 40 additions and 0 deletions

View File

@ -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() {}

View File

@ -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