mirror of
https://github.com/allankoechke/rust.git
synced 2026-12-04 09:44:40 +00:00
164 lines
4.9 KiB
Rust
164 lines
4.9 KiB
Rust
//@ run-rustfix
|
|
|
|
#![deny(rustdoc::bare_urls)]
|
|
|
|
/// <https://somewhere.com>
|
|
//~^ ERROR this URL is not a hyperlink
|
|
/// <https://somewhere.com/a>
|
|
//~^ ERROR this URL is not a hyperlink
|
|
/// <https://www.somewhere.com>
|
|
//~^ ERROR this URL is not a hyperlink
|
|
/// <https://www.somewhere.com/a>
|
|
//~^ ERROR this URL is not a hyperlink
|
|
/// <https://subdomain.example.com>
|
|
//~^ ERROR not a hyperlink
|
|
/// <https://somewhere.com?>
|
|
//~^ ERROR this URL is not a hyperlink
|
|
/// <https://somewhere.com/a?>
|
|
//~^ ERROR this URL is not a hyperlink
|
|
/// <https://somewhere.com?hello=12>
|
|
//~^ ERROR this URL is not a hyperlink
|
|
/// <https://somewhere.com/a?hello=12>
|
|
//~^ ERROR this URL is not a hyperlink
|
|
/// <https://example.com?hello=12#xyz>
|
|
//~^ ERROR this URL is not a hyperlink
|
|
/// <https://example.com/a?hello=12#xyz>
|
|
//~^ ERROR this URL is not a hyperlink
|
|
/// <https://example.com#xyz>
|
|
//~^ ERROR this URL is not a hyperlink
|
|
/// <https://example.com/a#xyz>
|
|
//~^ ERROR this URL is not a hyperlink
|
|
/// <https://somewhere.com?hello=12&bye=11>
|
|
//~^ ERROR this URL is not a hyperlink
|
|
/// <https://somewhere.com/a?hello=12&bye=11>
|
|
//~^ ERROR this URL is not a hyperlink
|
|
/// <https://somewhere.com?hello=12&bye=11#xyz>
|
|
//~^ ERROR this URL is not a hyperlink
|
|
/// hey! <https://somewhere.com/a?hello=12&bye=11#xyz>
|
|
//~^ ERROR this URL is not a hyperlink
|
|
pub fn c() {}
|
|
|
|
#[doc = "here's a thing: <https://example.com/>"]
|
|
//~^ ERROR this URL is not a hyperlink
|
|
pub fn f() {}
|
|
|
|
/// <https://example.com/sugar>
|
|
//~^ ERROR this URL is not a hyperlink
|
|
#[doc = "<https://example.com/raw>"]
|
|
//~^ ERROR this URL is not a hyperlink
|
|
pub fn mixed() {}
|
|
|
|
/// <https://somewhere.com>
|
|
/// [a](http://a.com)
|
|
/// [b]
|
|
///
|
|
/// [b]: http://b.com
|
|
///
|
|
/// ```
|
|
/// This link should not be linted: http://example.com
|
|
///
|
|
/// Nor this one: <http://example.com> or this one: [x](http://example.com)
|
|
/// ```
|
|
///
|
|
/// [should_not.lint](should_not.lint)
|
|
pub fn everything_is_fine_here() {}
|
|
|
|
#[allow(rustdoc::bare_urls)]
|
|
pub mod foo {
|
|
/// https://somewhere.com/a?hello=12&bye=11#xyz
|
|
pub fn bar() {}
|
|
}
|
|
|
|
/// Visit <https://example.com/docs>.
|
|
//~^ ERROR this URL is not a hyperlink
|
|
/// Two sentences. <https://example.com>. And more text.
|
|
//~^ ERROR this URL is not a hyperlink
|
|
/// Trailing ellipsis <https://example.com/docs>...
|
|
//~^ ERROR this URL is not a hyperlink
|
|
/// A period in the middle of <https://example.com/a.b> is part of the URL.
|
|
//~^ ERROR this URL is not a hyperlink
|
|
pub fn trailing_period() {}
|
|
|
|
/// <https://bloob.blob>
|
|
//~^ ERROR this URL is not a hyperlink
|
|
/// [ <https://bloob.blob> ]
|
|
//~^ ERROR this URL is not a hyperlink
|
|
/// [ <https://bloob.blob>]
|
|
//~^ ERROR this URL is not a hyperlink
|
|
/// [<https://bloob.blob> ]
|
|
//~^ ERROR this URL is not a hyperlink
|
|
/// [<https://bloob.blob>
|
|
//~^ ERROR this URL is not a hyperlink
|
|
/// <https://bloob.blob>]
|
|
//~^ ERROR this URL is not a hyperlink
|
|
pub fn lint_with_brackets() {}
|
|
|
|
/// See <https://example.com/test_.html>
|
|
//~^ ERROR this URL is not a hyperlink
|
|
pub fn underscore_without_parens_1() {}
|
|
|
|
/// See <https://example.com/test._html>
|
|
//~^ ERROR this URL is not a hyperlink
|
|
pub fn underscore_without_parens_2() {}
|
|
|
|
/// See _<https://example.com/test.html_>
|
|
//~^ ERROR this URL is not a hyperlink
|
|
pub fn underscore_emphasis_without_parens() {}
|
|
|
|
/// See <https://en.wikipedia.org/wiki/Rust_(programming_language)>
|
|
//~^ ERROR this URL is not a hyperlink
|
|
pub fn wikipedia_example() {}
|
|
|
|
/// See (<http://example.com/(1(2))>)
|
|
//~^ ERROR this URL is not a hyperlink
|
|
pub fn nested_parens_balanced_1() {}
|
|
|
|
/// See (1(<http://example.com/1(2)>))
|
|
//~^ ERROR this URL is not a hyperlink
|
|
pub fn nested_parens_balanced_2() {}
|
|
|
|
/// See (1(<http://example.com/1(.)>
|
|
//~^ ERROR this URL is not a hyperlink
|
|
pub fn nested_parens_balanced_3() {}
|
|
|
|
/// See <http://example.com/(1(2))>)
|
|
//~^ ERROR this URL is not a hyperlink
|
|
pub fn nested_parens_unbalanced_1() {}
|
|
|
|
/// See <http://example.com/test>(.
|
|
//~^ ERROR this URL is not a hyperlink
|
|
pub fn nested_parens_unbalanced_2() {}
|
|
|
|
/// See <http://example.com/test>.(
|
|
//~^ ERROR this URL is not a hyperlink
|
|
pub fn nested_parens_unbalanced_3() {}
|
|
|
|
/// See <http://example.com/test>).
|
|
//~^ ERROR this URL is not a hyperlink
|
|
pub fn nested_parens_unbalanced_4() {}
|
|
|
|
/// See <http://example.com/test>.)
|
|
//~^ ERROR this URL is not a hyperlink
|
|
pub fn nested_parens_unbalanced_5() {}
|
|
|
|
/// See http://ex(amp)le.com/
|
|
pub fn nested_parens_cannot_appear_in_host() {}
|
|
|
|
/// The path component of a URL must be separated from the rest by a `/`,
|
|
/// so the `=a` isn't part of the URL.
|
|
/// <https://foo.bar>=a
|
|
//~^ ERROR this URL is not a hyperlink
|
|
pub fn equal_sign_after_host() {}
|
|
|
|
/// A URL can, however, have a fragment or query without a slash.
|
|
/// <https://foo.bar#a> or <https://foo.bar?a>
|
|
//~^ ERROR this URL is not a hyperlink
|
|
//~| ERROR this URL is not a hyperlink
|
|
pub fn hash_or_question_after_host() {}
|
|
|
|
/// This URL contains italics,
|
|
/// but should still produce a suggestion that wraps the whole thing.
|
|
/// <https://example.com/_foo_/bar>
|
|
//~^ ERROR this URL is not a hyperlink
|
|
pub fn italics() {}
|