Skip to content

Lint rustdoc::bare_urls suggests turning [URL] into [<URL>] instead of <URL> #146162

@fmease

Description

@fmease

Seen in #146159 (comment).

Reproducer:

//! [https://github.com]
warning: this URL is not a hyperlink
 --> <anon>:1:6
  |
1 | //! [https://github.com]
  |      ^^^^^^^^^^^^^^^^^^
  |
  = note: bare URLs are not automatically turned into clickable links
  = note: `#[warn(rustdoc::bare_urls)]` on by default
help: use an automatic link instead
  |
1 | //! [<https://github.com>]
  |      +                  +

Of course, [<URL>] does turn the URL into a hyperlink but it results in extra verbatim [ ] in the rendered output which is likely not what the user wants.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.A-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`C-enhancementCategory: An issue proposing an enhancement or a PR with one.D-papercutDiagnostics: An error or lint that needs small tweaks.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions