File tree Expand file tree Collapse file tree 2 files changed +43
-3
lines changed
compiler/rustc_session/src/lint Expand file tree Collapse file tree 2 files changed +43
-3
lines changed Original file line number Diff line number Diff line change @@ -1893,13 +1893,13 @@ declare_lint! {
1893
1893
1894
1894
declare_lint ! {
1895
1895
/// The `automatic_links` lint detects when a URL/email address could be
1896
- /// written using only brackets. This is a `rustdoc` only lint, see the
1897
- /// documentation in the [rustdoc book].
1896
+ /// written using only angle brackets. This is a `rustdoc` only lint, see
1897
+ /// the documentation in the [rustdoc book].
1898
1898
///
1899
1899
/// [rustdoc book]: ../../../rustdoc/lints.html#automatic_links
1900
1900
pub AUTOMATIC_LINKS ,
1901
1901
Allow ,
1902
- "detects URLs/email adresses that could be written using only brackets"
1902
+ "detects URLs/email adresses that could be written using only angle brackets"
1903
1903
}
1904
1904
1905
1905
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