diff options
| -rw-r--r-- | clippy_lints/src/doc/mod.rs | 1 | ||||
| -rw-r--r-- | tests/ui/doc/doc_comment_double_space_linebreaks.fixed | 22 | ||||
| -rw-r--r-- | tests/ui/doc/doc_comment_double_space_linebreaks.rs | 22 | ||||
| -rw-r--r-- | tests/ui/doc/doc_comment_double_space_linebreaks.stderr | 10 |
4 files changed, 32 insertions, 23 deletions
diff --git a/clippy_lints/src/doc/mod.rs b/clippy_lints/src/doc/mod.rs index 8e5682494e9..36fd396cc1d 100644 --- a/clippy_lints/src/doc/mod.rs +++ b/clippy_lints/src/doc/mod.rs @@ -569,6 +569,7 @@ declare_clippy_lint! { } declare_clippy_lint! { + /// ### What it does /// Detects doc comment linebreaks that use double spaces to separate lines, instead of back-slash (`\`). /// /// ### Why is this bad? diff --git a/tests/ui/doc/doc_comment_double_space_linebreaks.fixed b/tests/ui/doc/doc_comment_double_space_linebreaks.fixed index efcd56809b7..6a616b2c7e1 100644 --- a/tests/ui/doc/doc_comment_double_space_linebreaks.fixed +++ b/tests/ui/doc/doc_comment_double_space_linebreaks.fixed @@ -1,9 +1,10 @@ #![feature(custom_inner_attributes)] #![rustfmt::skip] -#![warn(clippy::doc_comment_double_space_linebreak)] +#![warn(clippy::doc_comment_double_space_linebreaks)] #![allow(unused, clippy::empty_docs)] +//~v doc_comment_double_space_linebreaks //! Should warn on double space linebreaks\ //! in file/module doc comment @@ -22,16 +23,17 @@ fn single_line_split() {} #[doc = "This is a doc attribute, which should not be linted"] fn normal_comment() { - /* - Should not warn on block comments - */ - - /* - Should not warn on block comments - with double space at the end of a line - */ + /* + Should not warn on block comments + */ + + /* + Should not warn on block comments + with double space at the end of a line + */ } +//~v doc_comment_double_space_linebreaks /// Should warn when doc comment uses double space\ /// as a line-break, even when there are multiple\ /// in a row @@ -41,6 +43,7 @@ fn double_space_doc_comment() {} /// as a line-break fn back_slash_doc_comment() {} +//~v doc_comment_double_space_linebreaks /// 🌹 are 🟥\ /// 🌷 are 🟦\ /// 📎 is 😎\ @@ -83,6 +86,7 @@ fn inline() {} /// https://example.com) in a URL. fn url() {} +//~v doc_comment_double_space_linebreaks /// here we mix\ /// double spaces\ /// and also\ diff --git a/tests/ui/doc/doc_comment_double_space_linebreaks.rs b/tests/ui/doc/doc_comment_double_space_linebreaks.rs index c64eedc2428..e36cf7dea23 100644 --- a/tests/ui/doc/doc_comment_double_space_linebreaks.rs +++ b/tests/ui/doc/doc_comment_double_space_linebreaks.rs @@ -1,9 +1,10 @@ #![feature(custom_inner_attributes)] #![rustfmt::skip] -#![warn(clippy::doc_comment_double_space_linebreak)] +#![warn(clippy::doc_comment_double_space_linebreaks)] #![allow(unused, clippy::empty_docs)] +//~v doc_comment_double_space_linebreaks //! Should warn on double space linebreaks //! in file/module doc comment @@ -22,16 +23,17 @@ fn single_line_split() {} #[doc = "This is a doc attribute, which should not be linted"] fn normal_comment() { - /* - Should not warn on block comments - */ - - /* - Should not warn on block comments - with double space at the end of a line - */ + /* + Should not warn on block comments + */ + + /* + Should not warn on block comments + with double space at the end of a line + */ } +//~v doc_comment_double_space_linebreaks /// Should warn when doc comment uses double space /// as a line-break, even when there are multiple /// in a row @@ -41,6 +43,7 @@ fn double_space_doc_comment() {} /// as a line-break fn back_slash_doc_comment() {} +//~v doc_comment_double_space_linebreaks /// 🌹 are 🟥 /// 🌷 are 🟦 /// 📎 is 😎 @@ -83,6 +86,7 @@ fn inline() {} /// https://example.com) in a URL. fn url() {} +//~v doc_comment_double_space_linebreaks /// here we mix /// double spaces\ /// and also diff --git a/tests/ui/doc/doc_comment_double_space_linebreaks.stderr b/tests/ui/doc/doc_comment_double_space_linebreaks.stderr index 41b0790e5d3..08c6956c3d0 100644 --- a/tests/ui/doc/doc_comment_double_space_linebreaks.stderr +++ b/tests/ui/doc/doc_comment_double_space_linebreaks.stderr @@ -1,15 +1,15 @@ error: doc comment uses two spaces for a hard line break - --> tests/ui/doc/doc_comment_double_space_linebreaks.rs:7:43 + --> tests/ui/doc/doc_comment_double_space_linebreaks.rs:8:43 | LL | //! Should warn on double space linebreaks | ^^ | = help: replace this double space with a backslash: `\` - = note: `-D clippy::doc-comment-double-space-linebreak` implied by `-D warnings` + = note: `-D clippy::doc-comment-double-space-linebreaks` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::doc_comment_double_space_linebreaks)]` error: doc comment uses two spaces for a hard line break - --> tests/ui/doc/doc_comment_double_space_linebreaks.rs:35:51 + --> tests/ui/doc/doc_comment_double_space_linebreaks.rs:37:51 | LL | /// Should warn when doc comment uses double space | ^^ @@ -19,7 +19,7 @@ LL | /// as a line-break, even when there are multiple = help: replace this double space with a backslash: `\` error: doc comment uses two spaces for a hard line break - --> tests/ui/doc/doc_comment_double_space_linebreaks.rs:44:12 + --> tests/ui/doc/doc_comment_double_space_linebreaks.rs:47:12 | LL | /// 🌹 are 🟥 | ^^ @@ -33,7 +33,7 @@ LL | /// and so are 🫵 = help: replace this double space with a backslash: `\` error: doc comment uses two spaces for a hard line break - --> tests/ui/doc/doc_comment_double_space_linebreaks.rs:86:16 + --> tests/ui/doc/doc_comment_double_space_linebreaks.rs:90:16 | LL | /// here we mix | ^^ |
