Add suggestion to missing backticks error
This commit is contained in:
parent
c68af43b3d
commit
0db8c52291
|
@ -1,6 +1,6 @@
|
||||||
use clippy_utils::attrs::is_doc_hidden;
|
use clippy_utils::attrs::is_doc_hidden;
|
||||||
use clippy_utils::diagnostics::{span_lint, span_lint_and_help, span_lint_and_note};
|
use clippy_utils::diagnostics::{span_lint, span_lint_and_help, span_lint_and_note, span_lint_and_sugg};
|
||||||
use clippy_utils::source::first_line_of_span;
|
use clippy_utils::source::{first_line_of_span, snippet_with_applicability};
|
||||||
use clippy_utils::ty::{implements_trait, is_type_diagnostic_item};
|
use clippy_utils::ty::{implements_trait, is_type_diagnostic_item};
|
||||||
use clippy_utils::{is_entrypoint_fn, is_expn_of, match_panic_def_id, method_chain_args, return_ty};
|
use clippy_utils::{is_entrypoint_fn, is_expn_of, match_panic_def_id, method_chain_args, return_ty};
|
||||||
use if_chain::if_chain;
|
use if_chain::if_chain;
|
||||||
|
@ -10,7 +10,7 @@ use rustc_ast::token::CommentKind;
|
||||||
use rustc_data_structures::fx::FxHashSet;
|
use rustc_data_structures::fx::FxHashSet;
|
||||||
use rustc_data_structures::sync::Lrc;
|
use rustc_data_structures::sync::Lrc;
|
||||||
use rustc_errors::emitter::EmitterWriter;
|
use rustc_errors::emitter::EmitterWriter;
|
||||||
use rustc_errors::Handler;
|
use rustc_errors::{Applicability, Handler};
|
||||||
use rustc_hir as hir;
|
use rustc_hir as hir;
|
||||||
use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor};
|
use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor};
|
||||||
use rustc_hir::{AnonConst, Expr, ExprKind, QPath};
|
use rustc_hir::{AnonConst, Expr, ExprKind, QPath};
|
||||||
|
@ -48,7 +48,7 @@ declare_clippy_lint! {
|
||||||
/// content are not linted.
|
/// content are not linted.
|
||||||
///
|
///
|
||||||
/// In addition, when writing documentation comments, including `[]` brackets
|
/// In addition, when writing documentation comments, including `[]` brackets
|
||||||
/// inside a link text would trip the parser. Therfore, documenting link with
|
/// inside a link text would trip the parser. Therefore, documenting link with
|
||||||
/// `[`SmallVec<[T; INLINE_CAPACITY]>`]` and then [`SmallVec<[T; INLINE_CAPACITY]>`]: SmallVec
|
/// `[`SmallVec<[T; INLINE_CAPACITY]>`]` and then [`SmallVec<[T; INLINE_CAPACITY]>`]: SmallVec
|
||||||
/// would fail.
|
/// would fail.
|
||||||
///
|
///
|
||||||
|
@ -755,17 +755,22 @@ fn check_word(cx: &LateContext<'_>, word: &str, span: Span) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// We assume that mixed-case words are not meant to be put inside bacticks. (Issue #2343)
|
// We assume that mixed-case words are not meant to be put inside backticks. (Issue #2343)
|
||||||
if has_underscore(word) && has_hyphen(word) {
|
if has_underscore(word) && has_hyphen(word) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if has_underscore(word) || word.contains("::") || is_camel_case(word) {
|
if has_underscore(word) || word.contains("::") || is_camel_case(word) {
|
||||||
span_lint(
|
let mut applicability = Applicability::MachineApplicable;
|
||||||
|
|
||||||
|
span_lint_and_sugg(
|
||||||
cx,
|
cx,
|
||||||
DOC_MARKDOWN,
|
DOC_MARKDOWN,
|
||||||
span,
|
span,
|
||||||
&format!("you should put `{}` between ticks in the documentation", word),
|
"item in documentation is missing backticks",
|
||||||
|
"try",
|
||||||
|
format!("`{}`", snippet_with_applicability(cx, span, "..", &mut applicability)),
|
||||||
|
applicability,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -804,9 +809,9 @@ impl<'a, 'tcx> Visitor<'tcx> for FindPanicUnwrap<'a, 'tcx> {
|
||||||
|
|
||||||
// check for `unwrap`
|
// check for `unwrap`
|
||||||
if let Some(arglists) = method_chain_args(expr, &["unwrap"]) {
|
if let Some(arglists) = method_chain_args(expr, &["unwrap"]) {
|
||||||
let reciever_ty = self.typeck_results.expr_ty(&arglists[0][0]).peel_refs();
|
let receiver_ty = self.typeck_results.expr_ty(&arglists[0][0]).peel_refs();
|
||||||
if is_type_diagnostic_item(self.cx, reciever_ty, sym::Option)
|
if is_type_diagnostic_item(self.cx, receiver_ty, sym::Option)
|
||||||
|| is_type_diagnostic_item(self.cx, reciever_ty, sym::Result)
|
|| is_type_diagnostic_item(self.cx, receiver_ty, sym::Result)
|
||||||
{
|
{
|
||||||
self.panic_span = Some(expr.span);
|
self.panic_span = Some(expr.span);
|
||||||
}
|
}
|
||||||
|
|
215
tests/ui/doc/doc.fixed
Normal file
215
tests/ui/doc/doc.fixed
Normal file
|
@ -0,0 +1,215 @@
|
||||||
|
// run-rustfix
|
||||||
|
//! This file tests for the `DOC_MARKDOWN` lint.
|
||||||
|
|
||||||
|
#![allow(dead_code, incomplete_features)]
|
||||||
|
#![warn(clippy::doc_markdown)]
|
||||||
|
#![feature(custom_inner_attributes, generic_const_exprs, const_option)]
|
||||||
|
#![rustfmt::skip]
|
||||||
|
|
||||||
|
/// The `foo_bar` function does _nothing_. See also `foo::bar`. (note the dot there)
|
||||||
|
/// Markdown is _weird_. I mean _really weird_. This \_ is ok. So is `_`. But not `Foo::some_fun`
|
||||||
|
/// which should be reported only once despite being __doubly bad__.
|
||||||
|
/// Here be `::a::global:path`, and _`::another::global::path`_. :: is not a path though.
|
||||||
|
/// Import an item from `::awesome::global::blob::` (Intended postfix)
|
||||||
|
/// These are the options for `::Cat`: (Intended trailing single colon, shouldn't be linted)
|
||||||
|
/// That's not code ~`NotInCodeBlock`~.
|
||||||
|
/// `be_sure_we_got_to_the_end_of_it`
|
||||||
|
fn foo_bar() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/// That one tests multiline ticks.
|
||||||
|
/// ```rust
|
||||||
|
/// foo_bar FOO_BAR
|
||||||
|
/// _foo bar_
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
|
/// ~~~rust
|
||||||
|
/// foo_bar FOO_BAR
|
||||||
|
/// _foo bar_
|
||||||
|
/// ~~~
|
||||||
|
/// `be_sure_we_got_to_the_end_of_it`
|
||||||
|
fn multiline_codeblock() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/// This _is a test for
|
||||||
|
/// multiline
|
||||||
|
/// emphasis_.
|
||||||
|
/// `be_sure_we_got_to_the_end_of_it`
|
||||||
|
fn test_emphasis() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/// This tests units. See also #835.
|
||||||
|
/// kiB MiB GiB TiB PiB EiB
|
||||||
|
/// kib Mib Gib Tib Pib Eib
|
||||||
|
/// kB MB GB TB PB EB
|
||||||
|
/// kb Mb Gb Tb Pb Eb
|
||||||
|
/// 32kiB 32MiB 32GiB 32TiB 32PiB 32EiB
|
||||||
|
/// 32kib 32Mib 32Gib 32Tib 32Pib 32Eib
|
||||||
|
/// 32kB 32MB 32GB 32TB 32PB 32EB
|
||||||
|
/// 32kb 32Mb 32Gb 32Tb 32Pb 32Eb
|
||||||
|
/// NaN
|
||||||
|
/// `be_sure_we_got_to_the_end_of_it`
|
||||||
|
fn test_units() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/// This tests allowed identifiers.
|
||||||
|
/// KiB MiB GiB TiB PiB EiB
|
||||||
|
/// DirectX
|
||||||
|
/// ECMAScript
|
||||||
|
/// GPLv2 GPLv3
|
||||||
|
/// GitHub GitLab
|
||||||
|
/// IPv4 IPv6
|
||||||
|
/// ClojureScript CoffeeScript JavaScript PureScript TypeScript
|
||||||
|
/// NaN NaNs
|
||||||
|
/// OAuth GraphQL
|
||||||
|
/// OCaml
|
||||||
|
/// OpenGL OpenMP OpenSSH OpenSSL OpenStreetMap OpenDNS
|
||||||
|
/// WebGL
|
||||||
|
/// TensorFlow
|
||||||
|
/// TrueType
|
||||||
|
/// iOS macOS FreeBSD
|
||||||
|
/// TeX LaTeX BibTeX BibLaTeX
|
||||||
|
/// MinGW
|
||||||
|
/// CamelCase (see also #2395)
|
||||||
|
/// `be_sure_we_got_to_the_end_of_it`
|
||||||
|
fn test_allowed() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/// This test has [a `link_with_underscores`][chunked-example] inside it. See #823.
|
||||||
|
/// See also [the issue tracker](https://github.com/rust-lang/rust-clippy/search?q=clippy::doc_markdown&type=Issues)
|
||||||
|
/// on GitHub (which is a camel-cased word, but is OK). And here is another [inline link][inline_link].
|
||||||
|
/// It can also be [`inline_link2`].
|
||||||
|
///
|
||||||
|
/// [chunked-example]: https://en.wikipedia.org/wiki/Chunked_transfer_encoding#Example
|
||||||
|
/// [inline_link]: https://foobar
|
||||||
|
/// [inline_link2]: https://foobar
|
||||||
|
/// The `main` function is the entry point of the program. Here it only calls the `foo_bar` and
|
||||||
|
/// `multiline_ticks` functions.
|
||||||
|
///
|
||||||
|
/// expression of the type `_ <bit_op> m <cmp_op> c` (where `<bit_op>`
|
||||||
|
/// is one of {`&`, '|'} and `<cmp_op>` is one of {`!=`, `>=`, `>` ,
|
||||||
|
/// `be_sure_we_got_to_the_end_of_it`
|
||||||
|
fn main() {
|
||||||
|
foo_bar();
|
||||||
|
multiline_codeblock();
|
||||||
|
test_emphasis();
|
||||||
|
test_units();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// ## `CamelCaseThing`
|
||||||
|
/// Talks about `CamelCaseThing`. Titles should be ignored; see issue #897.
|
||||||
|
///
|
||||||
|
/// # `CamelCaseThing`
|
||||||
|
///
|
||||||
|
/// Not a title #897 `CamelCaseThing`
|
||||||
|
/// `be_sure_we_got_to_the_end_of_it`
|
||||||
|
fn issue897() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/// I am confused by brackets? (`x_y`)
|
||||||
|
/// I am confused by brackets? (foo `x_y`)
|
||||||
|
/// I am confused by brackets? (`x_y` foo)
|
||||||
|
/// `be_sure_we_got_to_the_end_of_it`
|
||||||
|
fn issue900() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Diesel queries also have a similar problem to [Iterator][iterator], where
|
||||||
|
/// /// More talking
|
||||||
|
/// returning them from a function requires exposing the implementation of that
|
||||||
|
/// function. The [`helper_types`][helper_types] module exists to help with this,
|
||||||
|
/// but you might want to hide the return type or have it conditionally change.
|
||||||
|
/// Boxing can achieve both.
|
||||||
|
///
|
||||||
|
/// [iterator]: https://doc.rust-lang.org/stable/std/iter/trait.Iterator.html
|
||||||
|
/// [helper_types]: ../helper_types/index.html
|
||||||
|
/// `be_sure_we_got_to_the_end_of_it`
|
||||||
|
fn issue883() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/// `foo_bar
|
||||||
|
/// baz_quz`
|
||||||
|
/// [foo
|
||||||
|
/// bar](https://doc.rust-lang.org/stable/std/iter/trait.IteratorFooBar.html)
|
||||||
|
fn multiline() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/** E.g., serialization of an empty list: `FooBar`
|
||||||
|
```
|
||||||
|
That's in a code block: `PackedNode`
|
||||||
|
```
|
||||||
|
|
||||||
|
And `BarQuz` too.
|
||||||
|
`be_sure_we_got_to_the_end_of_it`
|
||||||
|
*/
|
||||||
|
fn issue1073() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/** E.g., serialization of an empty list: `FooBar`
|
||||||
|
```
|
||||||
|
That's in a code block: PackedNode
|
||||||
|
```
|
||||||
|
|
||||||
|
And `BarQuz` too.
|
||||||
|
`be_sure_we_got_to_the_end_of_it`
|
||||||
|
*/
|
||||||
|
fn issue1073_alt() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Tests more than three quotes:
|
||||||
|
/// ````
|
||||||
|
/// DoNotWarn
|
||||||
|
/// ```
|
||||||
|
/// StillDont
|
||||||
|
/// ````
|
||||||
|
/// `be_sure_we_got_to_the_end_of_it`
|
||||||
|
fn four_quotes() {
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(feature = "a", doc = " ```")]
|
||||||
|
#[cfg_attr(not(feature = "a"), doc = " ```ignore")]
|
||||||
|
/// fn main() {
|
||||||
|
/// let s = "localhost:10000".to_string();
|
||||||
|
/// println!("{}", s);
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
fn issue_1469() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is a doc comment that should not be a list
|
||||||
|
*This would also be an error under a strict common mark interpretation
|
||||||
|
*/
|
||||||
|
fn issue_1920() {}
|
||||||
|
|
||||||
|
/// An iterator over `mycrate::Collection`'s values.
|
||||||
|
/// It should not lint a `'static` lifetime in ticks.
|
||||||
|
fn issue_2210() {}
|
||||||
|
|
||||||
|
/// This should not cause the lint to trigger:
|
||||||
|
/// #REQ-data-family.lint_partof_exists
|
||||||
|
fn issue_2343() {}
|
||||||
|
|
||||||
|
/// This should not cause an ICE:
|
||||||
|
/// __|_ _|__||_|
|
||||||
|
fn pulldown_cmark_crash() {}
|
||||||
|
|
||||||
|
/// This should not lint
|
||||||
|
/// (regression test for #7758)
|
||||||
|
/// [plain text][path::to::item]
|
||||||
|
fn intra_doc_link() {}
|
||||||
|
|
||||||
|
// issue #7033 - generic_const_exprs ICE
|
||||||
|
struct S<T, const N: usize>
|
||||||
|
where [(); N.checked_next_power_of_two().unwrap()]: {
|
||||||
|
arr: [T; N.checked_next_power_of_two().unwrap()],
|
||||||
|
n: usize,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T: Copy + Default, const N: usize> S<T, N>
|
||||||
|
where [(); N.checked_next_power_of_two().unwrap()]: {
|
||||||
|
fn new() -> Self {
|
||||||
|
Self {
|
||||||
|
arr: [T::default(); N.checked_next_power_of_two().unwrap()],
|
||||||
|
n: 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,3 +1,4 @@
|
||||||
|
// run-rustfix
|
||||||
//! This file tests for the `DOC_MARKDOWN` lint.
|
//! This file tests for the `DOC_MARKDOWN` lint.
|
||||||
|
|
||||||
#![allow(dead_code, incomplete_features)]
|
#![allow(dead_code, incomplete_features)]
|
||||||
|
@ -164,12 +165,6 @@ fn issue1073_alt() {
|
||||||
fn four_quotes() {
|
fn four_quotes() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// See [NIST SP 800-56A, revision 2].
|
|
||||||
///
|
|
||||||
/// [NIST SP 800-56A, revision 2]:
|
|
||||||
/// https://github.com/rust-lang/rust-clippy/issues/902#issuecomment-261919419
|
|
||||||
fn issue_902_comment() {}
|
|
||||||
|
|
||||||
#[cfg_attr(feature = "a", doc = " ```")]
|
#[cfg_attr(feature = "a", doc = " ```")]
|
||||||
#[cfg_attr(not(feature = "a"), doc = " ```ignore")]
|
#[cfg_attr(not(feature = "a"), doc = " ```ignore")]
|
||||||
/// fn main() {
|
/// fn main() {
|
||||||
|
@ -185,14 +180,6 @@ fn issue_1469() {}
|
||||||
*/
|
*/
|
||||||
fn issue_1920() {}
|
fn issue_1920() {}
|
||||||
|
|
||||||
/// Ok: <http://www.unicode.org/reports/tr9/#Reordering_Resolved_Levels>
|
|
||||||
///
|
|
||||||
/// Not ok: http://www.unicode.org
|
|
||||||
/// Not ok: https://www.unicode.org
|
|
||||||
/// Not ok: http://www.unicode.org/
|
|
||||||
/// Not ok: http://www.unicode.org/reports/tr9/#Reordering_Resolved_Levels
|
|
||||||
fn issue_1832() {}
|
|
||||||
|
|
||||||
/// An iterator over mycrate::Collection's values.
|
/// An iterator over mycrate::Collection's values.
|
||||||
/// It should not lint a `'static` lifetime in ticks.
|
/// It should not lint a `'static` lifetime in ticks.
|
||||||
fn issue_2210() {}
|
fn issue_2210() {}
|
||||||
|
|
|
@ -1,208 +1,184 @@
|
||||||
error: you should put `foo_bar` between ticks in the documentation
|
error: item in documentation is missing backticks
|
||||||
--> $DIR/doc.rs:8:9
|
--> $DIR/doc.rs:9:9
|
||||||
|
|
|
|
||||||
LL | /// The foo_bar function does _nothing_. See also foo::bar. (note the dot there)
|
LL | /// The foo_bar function does _nothing_. See also foo::bar. (note the dot there)
|
||||||
| ^^^^^^^
|
| ^^^^^^^ help: try: ``foo_bar``
|
||||||
|
|
|
|
||||||
= note: `-D clippy::doc-markdown` implied by `-D warnings`
|
= note: `-D clippy::doc-markdown` implied by `-D warnings`
|
||||||
|
|
||||||
error: you should put `foo::bar` between ticks in the documentation
|
error: item in documentation is missing backticks
|
||||||
--> $DIR/doc.rs:8:51
|
--> $DIR/doc.rs:9:51
|
||||||
|
|
|
|
||||||
LL | /// The foo_bar function does _nothing_. See also foo::bar. (note the dot there)
|
LL | /// The foo_bar function does _nothing_. See also foo::bar. (note the dot there)
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^ help: try: ``foo::bar``
|
||||||
|
|
||||||
error: you should put `Foo::some_fun` between ticks in the documentation
|
error: item in documentation is missing backticks
|
||||||
--> $DIR/doc.rs:9:83
|
--> $DIR/doc.rs:10:83
|
||||||
|
|
|
|
||||||
LL | /// Markdown is _weird_. I mean _really weird_. This /_ is ok. So is `_`. But not Foo::some_fun
|
LL | /// Markdown is _weird_. I mean _really weird_. This /_ is ok. So is `_`. But not Foo::some_fun
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^ help: try: ``Foo::some_fun``
|
||||||
|
|
||||||
error: you should put `::a::global:path` between ticks in the documentation
|
error: item in documentation is missing backticks
|
||||||
--> $DIR/doc.rs:11:13
|
--> $DIR/doc.rs:12:13
|
||||||
|
|
|
|
||||||
LL | /// Here be ::a::global:path, and _::another::global::path_. :: is not a path though.
|
LL | /// Here be ::a::global:path, and _::another::global::path_. :: is not a path though.
|
||||||
| ^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^ help: try: ``::a::global:path``
|
||||||
|
|
||||||
error: you should put `::another::global::path` between ticks in the documentation
|
error: item in documentation is missing backticks
|
||||||
--> $DIR/doc.rs:11:36
|
--> $DIR/doc.rs:12:36
|
||||||
|
|
|
|
||||||
LL | /// Here be ::a::global:path, and _::another::global::path_. :: is not a path though.
|
LL | /// Here be ::a::global:path, and _::another::global::path_. :: is not a path though.
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^ help: try: ``::another::global::path``
|
||||||
|
|
||||||
error: you should put `::awesome::global::blob::` between ticks in the documentation
|
error: item in documentation is missing backticks
|
||||||
--> $DIR/doc.rs:12:25
|
--> $DIR/doc.rs:13:25
|
||||||
|
|
|
|
||||||
LL | /// Import an item from ::awesome::global::blob:: (Intended postfix)
|
LL | /// Import an item from ::awesome::global::blob:: (Intended postfix)
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: ``::awesome::global::blob::``
|
||||||
|
|
||||||
error: you should put `::Cat` between ticks in the documentation
|
error: item in documentation is missing backticks
|
||||||
--> $DIR/doc.rs:13:31
|
--> $DIR/doc.rs:14:31
|
||||||
|
|
|
|
||||||
LL | /// These are the options for ::Cat: (Intended trailing single colon, shouldn't be linted)
|
LL | /// These are the options for ::Cat: (Intended trailing single colon, shouldn't be linted)
|
||||||
| ^^^^^
|
| ^^^^^ help: try: ``::Cat``
|
||||||
|
|
||||||
error: you should put `NotInCodeBlock` between ticks in the documentation
|
error: item in documentation is missing backticks
|
||||||
--> $DIR/doc.rs:14:22
|
--> $DIR/doc.rs:15:22
|
||||||
|
|
|
|
||||||
LL | /// That's not code ~NotInCodeBlock~.
|
LL | /// That's not code ~NotInCodeBlock~.
|
||||||
| ^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^ help: try: ``NotInCodeBlock``
|
||||||
|
|
||||||
error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
|
error: item in documentation is missing backticks
|
||||||
--> $DIR/doc.rs:15:5
|
--> $DIR/doc.rs:16:5
|
||||||
|
|
|
|
||||||
LL | /// be_sure_we_got_to_the_end_of_it
|
LL | /// be_sure_we_got_to_the_end_of_it
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: ``be_sure_we_got_to_the_end_of_it``
|
||||||
|
|
||||||
error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
|
error: item in documentation is missing backticks
|
||||||
--> $DIR/doc.rs:29:5
|
--> $DIR/doc.rs:30:5
|
||||||
|
|
|
|
||||||
LL | /// be_sure_we_got_to_the_end_of_it
|
LL | /// be_sure_we_got_to_the_end_of_it
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: ``be_sure_we_got_to_the_end_of_it``
|
||||||
|
|
||||||
error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
|
error: item in documentation is missing backticks
|
||||||
--> $DIR/doc.rs:36:5
|
--> $DIR/doc.rs:37:5
|
||||||
|
|
|
|
||||||
LL | /// be_sure_we_got_to_the_end_of_it
|
LL | /// be_sure_we_got_to_the_end_of_it
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: ``be_sure_we_got_to_the_end_of_it``
|
||||||
|
|
||||||
error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
|
error: item in documentation is missing backticks
|
||||||
--> $DIR/doc.rs:50:5
|
--> $DIR/doc.rs:51:5
|
||||||
|
|
|
|
||||||
LL | /// be_sure_we_got_to_the_end_of_it
|
LL | /// be_sure_we_got_to_the_end_of_it
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: ``be_sure_we_got_to_the_end_of_it``
|
||||||
|
|
||||||
error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
|
error: item in documentation is missing backticks
|
||||||
--> $DIR/doc.rs:73:5
|
--> $DIR/doc.rs:74:5
|
||||||
|
|
|
|
||||||
LL | /// be_sure_we_got_to_the_end_of_it
|
LL | /// be_sure_we_got_to_the_end_of_it
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: ``be_sure_we_got_to_the_end_of_it``
|
||||||
|
|
||||||
error: you should put `link_with_underscores` between ticks in the documentation
|
error: item in documentation is missing backticks
|
||||||
--> $DIR/doc.rs:77:22
|
--> $DIR/doc.rs:78:22
|
||||||
|
|
|
|
||||||
LL | /// This test has [a link_with_underscores][chunked-example] inside it. See #823.
|
LL | /// This test has [a link_with_underscores][chunked-example] inside it. See #823.
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^ help: try: ``link_with_underscores``
|
||||||
|
|
||||||
error: you should put `inline_link2` between ticks in the documentation
|
error: item in documentation is missing backticks
|
||||||
--> $DIR/doc.rs:80:21
|
--> $DIR/doc.rs:81:21
|
||||||
|
|
|
|
||||||
LL | /// It can also be [inline_link2].
|
LL | /// It can also be [inline_link2].
|
||||||
| ^^^^^^^^^^^^
|
| ^^^^^^^^^^^^ help: try: ``inline_link2``
|
||||||
|
|
||||||
error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
|
error: item in documentation is missing backticks
|
||||||
--> $DIR/doc.rs:90:5
|
--> $DIR/doc.rs:91:5
|
||||||
|
|
|
|
||||||
LL | /// be_sure_we_got_to_the_end_of_it
|
LL | /// be_sure_we_got_to_the_end_of_it
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: ``be_sure_we_got_to_the_end_of_it``
|
||||||
|
|
||||||
error: you should put `CamelCaseThing` between ticks in the documentation
|
error: item in documentation is missing backticks
|
||||||
--> $DIR/doc.rs:98:8
|
--> $DIR/doc.rs:99:8
|
||||||
|
|
|
|
||||||
LL | /// ## CamelCaseThing
|
LL | /// ## CamelCaseThing
|
||||||
| ^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^ help: try: ``CamelCaseThing``
|
||||||
|
|
||||||
error: you should put `CamelCaseThing` between ticks in the documentation
|
error: item in documentation is missing backticks
|
||||||
--> $DIR/doc.rs:101:7
|
--> $DIR/doc.rs:102:7
|
||||||
|
|
|
|
||||||
LL | /// # CamelCaseThing
|
LL | /// # CamelCaseThing
|
||||||
| ^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^ help: try: ``CamelCaseThing``
|
||||||
|
|
||||||
error: you should put `CamelCaseThing` between ticks in the documentation
|
error: item in documentation is missing backticks
|
||||||
--> $DIR/doc.rs:103:22
|
--> $DIR/doc.rs:104:22
|
||||||
|
|
|
|
||||||
LL | /// Not a title #897 CamelCaseThing
|
LL | /// Not a title #897 CamelCaseThing
|
||||||
| ^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^ help: try: ``CamelCaseThing``
|
||||||
|
|
||||||
error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
|
error: item in documentation is missing backticks
|
||||||
--> $DIR/doc.rs:104:5
|
--> $DIR/doc.rs:105:5
|
||||||
|
|
|
|
||||||
LL | /// be_sure_we_got_to_the_end_of_it
|
LL | /// be_sure_we_got_to_the_end_of_it
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: ``be_sure_we_got_to_the_end_of_it``
|
||||||
|
|
||||||
error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
|
error: item in documentation is missing backticks
|
||||||
--> $DIR/doc.rs:111:5
|
--> $DIR/doc.rs:112:5
|
||||||
|
|
|
|
||||||
LL | /// be_sure_we_got_to_the_end_of_it
|
LL | /// be_sure_we_got_to_the_end_of_it
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: ``be_sure_we_got_to_the_end_of_it``
|
||||||
|
|
||||||
error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
|
error: item in documentation is missing backticks
|
||||||
--> $DIR/doc.rs:124:5
|
--> $DIR/doc.rs:125:5
|
||||||
|
|
|
|
||||||
LL | /// be_sure_we_got_to_the_end_of_it
|
LL | /// be_sure_we_got_to_the_end_of_it
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: ``be_sure_we_got_to_the_end_of_it``
|
||||||
|
|
||||||
error: you should put `FooBar` between ticks in the documentation
|
error: item in documentation is missing backticks
|
||||||
--> $DIR/doc.rs:135:43
|
--> $DIR/doc.rs:136:43
|
||||||
|
|
|
|
||||||
LL | /** E.g., serialization of an empty list: FooBar
|
LL | /** E.g., serialization of an empty list: FooBar
|
||||||
| ^^^^^^
|
| ^^^^^^ help: try: ``FooBar``
|
||||||
|
|
||||||
error: you should put `BarQuz` between ticks in the documentation
|
error: item in documentation is missing backticks
|
||||||
--> $DIR/doc.rs:140:5
|
--> $DIR/doc.rs:141:5
|
||||||
|
|
|
|
||||||
LL | And BarQuz too.
|
LL | And BarQuz too.
|
||||||
| ^^^^^^
|
| ^^^^^^ help: try: ``BarQuz``
|
||||||
|
|
||||||
error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
|
error: item in documentation is missing backticks
|
||||||
--> $DIR/doc.rs:141:1
|
--> $DIR/doc.rs:142:1
|
||||||
|
|
|
|
||||||
LL | be_sure_we_got_to_the_end_of_it
|
LL | be_sure_we_got_to_the_end_of_it
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: ``be_sure_we_got_to_the_end_of_it``
|
||||||
|
|
||||||
error: you should put `FooBar` between ticks in the documentation
|
error: item in documentation is missing backticks
|
||||||
--> $DIR/doc.rs:146:43
|
--> $DIR/doc.rs:147:43
|
||||||
|
|
|
|
||||||
LL | /** E.g., serialization of an empty list: FooBar
|
LL | /** E.g., serialization of an empty list: FooBar
|
||||||
| ^^^^^^
|
| ^^^^^^ help: try: ``FooBar``
|
||||||
|
|
||||||
error: you should put `BarQuz` between ticks in the documentation
|
error: item in documentation is missing backticks
|
||||||
--> $DIR/doc.rs:151:5
|
--> $DIR/doc.rs:152:5
|
||||||
|
|
|
|
||||||
LL | And BarQuz too.
|
LL | And BarQuz too.
|
||||||
| ^^^^^^
|
| ^^^^^^ help: try: ``BarQuz``
|
||||||
|
|
||||||
error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
|
error: item in documentation is missing backticks
|
||||||
--> $DIR/doc.rs:152:1
|
--> $DIR/doc.rs:153:1
|
||||||
|
|
|
|
||||||
LL | be_sure_we_got_to_the_end_of_it
|
LL | be_sure_we_got_to_the_end_of_it
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: ``be_sure_we_got_to_the_end_of_it``
|
||||||
|
|
||||||
error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
|
error: item in documentation is missing backticks
|
||||||
--> $DIR/doc.rs:163:5
|
--> $DIR/doc.rs:164:5
|
||||||
|
|
|
|
||||||
LL | /// be_sure_we_got_to_the_end_of_it
|
LL | /// be_sure_we_got_to_the_end_of_it
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: ``be_sure_we_got_to_the_end_of_it``
|
||||||
|
|
||||||
error: you should put bare URLs between `<`/`>` or make a proper Markdown link
|
error: item in documentation is missing backticks
|
||||||
--> $DIR/doc.rs:190:13
|
--> $DIR/doc.rs:183:22
|
||||||
|
|
|
||||||
LL | /// Not ok: http://www.unicode.org
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
error: you should put bare URLs between `<`/`>` or make a proper Markdown link
|
|
||||||
--> $DIR/doc.rs:191:13
|
|
||||||
|
|
|
||||||
LL | /// Not ok: https://www.unicode.org
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
error: you should put bare URLs between `<`/`>` or make a proper Markdown link
|
|
||||||
--> $DIR/doc.rs:192:13
|
|
||||||
|
|
|
||||||
LL | /// Not ok: http://www.unicode.org/
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
error: you should put bare URLs between `<`/`>` or make a proper Markdown link
|
|
||||||
--> $DIR/doc.rs:193:13
|
|
||||||
|
|
|
||||||
LL | /// Not ok: http://www.unicode.org/reports/tr9/#Reordering_Resolved_Levels
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
error: you should put `mycrate::Collection` between ticks in the documentation
|
|
||||||
--> $DIR/doc.rs:196:22
|
|
||||||
|
|
|
|
||||||
LL | /// An iterator over mycrate::Collection's values.
|
LL | /// An iterator over mycrate::Collection's values.
|
||||||
| ^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^ help: try: ``mycrate::Collection``
|
||||||
|
|
||||||
error: aborting due to 34 previous errors
|
error: aborting due to 30 previous errors
|
||||||
|
|
||||||
|
|
9
tests/ui/doc/issue_1832.rs
Normal file
9
tests/ui/doc/issue_1832.rs
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
/// Ok: <http://www.unicode.org/reports/tr9/#Reordering_Resolved_Levels>
|
||||||
|
///
|
||||||
|
/// Not ok: http://www.unicode.org
|
||||||
|
/// Not ok: https://www.unicode.org
|
||||||
|
/// Not ok: http://www.unicode.org/
|
||||||
|
/// Not ok: http://www.unicode.org/reports/tr9/#Reordering_Resolved_Levels
|
||||||
|
fn issue_1832() {}
|
||||||
|
|
||||||
|
fn main() {}
|
7
tests/ui/doc/issue_902.rs
Normal file
7
tests/ui/doc/issue_902.rs
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
/// See [NIST SP 800-56A, revision 2].
|
||||||
|
///
|
||||||
|
/// [NIST SP 800-56A, revision 2]:
|
||||||
|
/// https://github.com/rust-lang/rust-clippy/issues/902#issuecomment-261919419
|
||||||
|
fn issue_902_comment() {}
|
||||||
|
|
||||||
|
fn main() {}
|
|
@ -18,11 +18,11 @@ LL | /// This paragraph has `unbalanced_tick marks and should stop_linting.
|
||||||
|
|
|
|
||||||
= help: a backtick may be missing a pair
|
= help: a backtick may be missing a pair
|
||||||
|
|
||||||
error: you should put `should_be` between ticks in the documentation
|
error: item in documentation is missing backticks
|
||||||
--> $DIR/unbalanced_ticks.rs:15:32
|
--> $DIR/unbalanced_ticks.rs:15:32
|
||||||
|
|
|
|
||||||
LL | /// This paragraph is fine and should_be linted normally.
|
LL | /// This paragraph is fine and should_be linted normally.
|
||||||
| ^^^^^^^^^
|
| ^^^^^^^^^ help: try: ``should_be``
|
||||||
|
|
||||||
error: backticks are unbalanced
|
error: backticks are unbalanced
|
||||||
--> $DIR/unbalanced_ticks.rs:17:1
|
--> $DIR/unbalanced_ticks.rs:17:1
|
||||||
|
@ -32,11 +32,11 @@ LL | /// Double unbalanced backtick from ``here to here` should lint.
|
||||||
|
|
|
|
||||||
= help: a backtick may be missing a pair
|
= help: a backtick may be missing a pair
|
||||||
|
|
||||||
error: you should put `not_fine` between ticks in the documentation
|
error: item in documentation is missing backticks
|
||||||
--> $DIR/unbalanced_ticks.rs:30:8
|
--> $DIR/unbalanced_ticks.rs:30:8
|
||||||
|
|
|
|
||||||
LL | /// ## not_fine
|
LL | /// ## not_fine
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^ help: try: ``not_fine``
|
||||||
|
|
||||||
error: backticks are unbalanced
|
error: backticks are unbalanced
|
||||||
--> $DIR/unbalanced_ticks.rs:32:1
|
--> $DIR/unbalanced_ticks.rs:32:1
|
||||||
|
@ -54,11 +54,11 @@ LL | /// - This `item has unbalanced tick marks
|
||||||
|
|
|
|
||||||
= help: a backtick may be missing a pair
|
= help: a backtick may be missing a pair
|
||||||
|
|
||||||
error: you should put `backticks_here` between ticks in the documentation
|
error: item in documentation is missing backticks
|
||||||
--> $DIR/unbalanced_ticks.rs:35:23
|
--> $DIR/unbalanced_ticks.rs:35:23
|
||||||
|
|
|
|
||||||
LL | /// - This item needs backticks_here
|
LL | /// - This item needs backticks_here
|
||||||
| ^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^ help: try: ``backticks_here``
|
||||||
|
|
||||||
error: aborting due to 8 previous errors
|
error: aborting due to 8 previous errors
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue