Skip to content

Commit 8b70b84

Browse files
committed
Auto merge of rust-lang#6107 - nahuakang:ref_style_link_false_positive, r=flip1995
Ref style link false positive This PR does not fix rust-lang#5834, but it records the problematic link text as a **known problem** inside `doc_markdown` lint. r? `@flip1995` - [ ] Followed [lint naming conventions][lint_naming] - [ ] Added passing UI tests (including committed `.stderr` file) - [x] `cargo test` passes locally - [x] Executed `cargo dev update_lints` - [ ] Added lint documentation - [x] Run `cargo dev fmt` --- *Please keep the line below* changelog: Document problematic link text style as known problem for `doc_markdown`
2 parents dbc0285 + f302af3 commit 8b70b84

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

clippy_lints/src/doc.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,26 @@ declare_clippy_lint! {
3232
/// **Known problems:** Lots of bad docs won’t be fixed, what the lint checks
3333
/// for is limited, and there are still false positives.
3434
///
35+
/// In addition, when writing documentation comments, including `[]` brackets
36+
/// inside a link text would trip the parser. Therfore, documenting link with
37+
/// `[`SmallVec<[T; INLINE_CAPACITY]>`]` and then [`SmallVec<[T; INLINE_CAPACITY]>`]: SmallVec
38+
/// would fail.
39+
///
3540
/// **Examples:**
3641
/// ```rust
3742
/// /// Do something with the foo_bar parameter. See also
3843
/// /// that::other::module::foo.
3944
/// // ^ `foo_bar` and `that::other::module::foo` should be ticked.
4045
/// fn doit(foo_bar: usize) {}
4146
/// ```
47+
///
48+
/// ```rust
49+
/// // Link text with `[]` brackets should be written as following:
50+
/// /// Consume the array and return the inner
51+
/// /// [`SmallVec<[T; INLINE_CAPACITY]>`][SmallVec].
52+
/// /// [SmallVec]: SmallVec
53+
/// fn main() {}
54+
/// ```
4255
pub DOC_MARKDOWN,
4356
pedantic,
4457
"presence of `_`, `::` or camel-case outside backticks in documentation"

0 commit comments

Comments
 (0)