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! {
18931893
18941894declare_lint ! {
18951895 /// 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].
18981898 ///
18991899 /// [rustdoc book]: ../../../rustdoc/lints.html#automatic_links
19001900 pub AUTOMATIC_LINKS ,
19011901 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"
19031903}
19041904
19051905declare_lint ! {
Original file line number Diff line number Diff line change @@ -285,3 +285,43 @@ warning: unclosed HTML tag `h1`
285285
286286warning: 2 warnings emitted
287287```
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