File tree Expand file tree Collapse file tree 2 files changed +43
-3
lines changed
compiler/rustc_lint_defs/src Expand file tree Collapse file tree 2 files changed +43
-3
lines changed Original file line number Diff line number Diff line change @@ -1892,13 +1892,13 @@ declare_lint! {
1892
1892
1893
1893
declare_lint ! {
1894
1894
/// The `automatic_links` lint detects when a URL/email address could be
1895
- /// written using only brackets. This is a `rustdoc` only lint, see the
1896
- /// documentation in the [rustdoc book].
1895
+ /// written using only angle brackets. This is a `rustdoc` only lint, see
1896
+ /// the documentation in the [rustdoc book].
1897
1897
///
1898
1898
/// [rustdoc book]: ../../../rustdoc/lints.html#automatic_links
1899
1899
pub AUTOMATIC_LINKS ,
1900
1900
Allow ,
1901
- "detects URLs/email adresses that could be written using only brackets"
1901
+ "detects URLs/email adresses that could be written using only angle brackets"
1902
1902
}
1903
1903
1904
1904
declare_lint ! {
Original file line number Diff line number Diff line change @@ -285,3 +285,43 @@ warning: unclosed HTML tag `h1`
285
285
286
286
warning: 2 warnings emitted
287
287
```
288
+
289
+ ## automatic_links
290
+
291
+ This link is ** allowed by default** and is ** nightly-only** . It detects links
292
+ which could use the "automatic" link syntax. For example:
293
+
294
+ ``` rust
295
+ #![warn(automatic_links)]
296
+
297
+ /// [http://a.com](http://a.com)
298
+ /// [http://b.com]
299
+ ///
300
+ /// [http://b.com]: http://b.com
301
+ pub fn foo () {}
302
+ ```
303
+
304
+ Which will give:
305
+
306
+ ``` text
307
+ error: Unneeded long form for URL
308
+ --> foo.rs:3:5
309
+ |
310
+ 3 | /// [http://a.com](http://a.com)
311
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
312
+ |
313
+ note: the lint level is defined here
314
+ --> foo.rs:1:9
315
+ |
316
+ 1 | #![deny(automatic_links)]
317
+ | ^^^^^^^^^^^^^^^
318
+ = help: Try with `<http://a.com>` instead
319
+
320
+ error: Unneeded long form for URL
321
+ --> foo.rs:5:5
322
+ |
323
+ 5 | /// [http://b.com]
324
+ | ^^^^^^^^^^^^^^
325
+ |
326
+ = help: Try with `<http://b.com>` instead
327
+ ```
You can’t perform that action at this time.
0 commit comments