From bd9b9ffa043fb53a668590f49efda6e845c71483 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Tue, 5 Mar 2024 12:07:37 +0100 Subject: [PATCH] Add regression test for #9473 --- tests/ui/doc/issue_9473.fixed | 9 +++++++++ tests/ui/doc/issue_9473.rs | 9 +++++++++ tests/ui/doc/issue_9473.stderr | 15 +++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 tests/ui/doc/issue_9473.fixed create mode 100644 tests/ui/doc/issue_9473.rs create mode 100644 tests/ui/doc/issue_9473.stderr diff --git a/tests/ui/doc/issue_9473.fixed b/tests/ui/doc/issue_9473.fixed new file mode 100644 index 00000000000..276ce7620ca --- /dev/null +++ b/tests/ui/doc/issue_9473.fixed @@ -0,0 +1,9 @@ +#![warn(clippy::doc_markdown)] + +// Should not warn! +/// Blah blah blah [FooBar]<[FooBar]>. +pub struct Foo(u32); + +// Should warn. +/// Blah blah blah [FooBar]<[FooBar]>[`FooBar`]. +pub struct FooBar(u32); diff --git a/tests/ui/doc/issue_9473.rs b/tests/ui/doc/issue_9473.rs new file mode 100644 index 00000000000..52527f7106d --- /dev/null +++ b/tests/ui/doc/issue_9473.rs @@ -0,0 +1,9 @@ +#![warn(clippy::doc_markdown)] + +// Should not warn! +/// Blah blah blah [FooBar]<[FooBar]>. +pub struct Foo(u32); + +// Should warn. +/// Blah blah blah [FooBar]<[FooBar]>[FooBar]. +pub struct FooBar(u32); diff --git a/tests/ui/doc/issue_9473.stderr b/tests/ui/doc/issue_9473.stderr new file mode 100644 index 00000000000..35aa2884cc1 --- /dev/null +++ b/tests/ui/doc/issue_9473.stderr @@ -0,0 +1,15 @@ +error: item in documentation is missing backticks + --> tests/ui/doc/issue_9473.rs:8:58 + | +LL | /// Blah blah blah [FooBar]<[FooBar]>[FooBar]. + | ^^^^^^ + | + = note: `-D clippy::doc-markdown` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(clippy::doc_markdown)]` +help: try + | +LL | /// Blah blah blah [FooBar]<[FooBar]>[`FooBar`]. + | ~~~~~~~~ + +error: aborting due to 1 previous error +