Add tests for automatic_links lint
This commit is contained in:
parent
a54f043733
commit
6bc8965c41
2 changed files with 40 additions and 0 deletions
17
src/test/rustdoc-ui/automatic-links.rs
Normal file
17
src/test/rustdoc-ui/automatic-links.rs
Normal 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() {}
|
23
src/test/rustdoc-ui/automatic-links.stderr
Normal file
23
src/test/rustdoc-ui/automatic-links.stderr
Normal 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
|
||||||
|
|
Loading…
Reference in a new issue