File tree Expand file tree Collapse file tree 4 files changed +59
-6
lines changed Expand file tree Collapse file tree 4 files changed +59
-6
lines changed Original file line number Diff line number Diff line change @@ -442,7 +442,7 @@ declare_clippy_lint! {
442442 /// fn add(l: i32, r: i32) -> i32 {
443443 /// l + r
444444 /// }
445- /// ``````
445+ /// ```
446446 ///
447447 /// Use instead:
448448 /// ```no_run
@@ -454,7 +454,7 @@ declare_clippy_lint! {
454454 /// ```
455455 #[ clippy:: version = "1.80.0" ]
456456 pub DOC_COMMENT_DOUBLE_SPACE_LINEBREAK ,
457- restriction ,
457+ pedantic ,
458458 "double-space used for doc comment linebreak instead of `\\ `"
459459}
460460
Original file line number Diff line number Diff line change @@ -18,8 +18,9 @@ fn single_line_split() {}
1818
1919// note: cargo fmt can remove double spaces from normal and block comments
2020// Should not warn on normal comments
21- // with double spaces at the end of a line
21+ // with double spaces at the end of a line
2222
23+ #[doc = "This is a doc attribute, which should not be linted"]
2324fn normal_comment() {
2425 /*
2526 Should not warn on block comments
@@ -40,4 +41,21 @@ fn double_space_doc_comment() {}
4041/// as a line-break
4142fn back_slash_doc_comment() {}
4243
44+ /// 🌹 are 🟥\
45+ /// 🌷 are 🟦\
46+ /// 📎 is 😎\
47+ /// and so are 🫵\
48+ /// (hopefully no formatting weirdness linting this)
49+ fn multi_byte_chars_tada() {}
50+
51+ macro_rules! macro_that_makes_function {
52+ () => {
53+ /// Shouldn't lint on this!
54+ /// (hopefully)
55+ fn my_macro_created_function() {}
56+ }
57+ }
58+
59+ macro_that_makes_function!();
60+
4361fn main() {}
Original file line number Diff line number Diff line change @@ -18,8 +18,9 @@ fn single_line_split() {}
1818
1919// note: cargo fmt can remove double spaces from normal and block comments
2020// Should not warn on normal comments
21- // with double spaces at the end of a line
21+ // with double spaces at the end of a line
2222
23+ #[ doc = "This is a doc attribute, which should not be linted" ]
2324fn normal_comment ( ) {
2425 /*
2526 Should not warn on block comments
@@ -40,4 +41,21 @@ fn double_space_doc_comment() {}
4041/// as a line-break
4142fn back_slash_doc_comment ( ) { }
4243
44+ /// 🌹 are 🟥
45+ /// 🌷 are 🟦
46+ /// 📎 is 😎
47+ /// and so are 🫵
48+ /// (hopefully no formatting weirdness linting this)
49+ fn multi_byte_chars_tada ( ) { }
50+
51+ macro_rules! macro_that_makes_function {
52+ ( ) => {
53+ /// Shouldn't lint on this!
54+ /// (hopefully)
55+ fn my_macro_created_function( ) { }
56+ }
57+ }
58+
59+ macro_that_makes_function ! ( ) ;
60+
4361fn main ( ) { }
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ LL | //! Should warn on double space linebreaks
88 = help: to override `-D warnings` add `#[allow(clippy::doc_comment_double_space_linebreak)]`
99
1010error: doc comments should use a back-slash (\) instead of a double space to indicate a linebreak
11- --> tests/ui/doc/doc_comment_double_space_linebreak.rs:34 :1
11+ --> tests/ui/doc/doc_comment_double_space_linebreak.rs:35 :1
1212 |
1313LL | / /// Should warn when doc comment uses double space
1414LL | | /// as a line-break, even when there are multiple
@@ -20,5 +20,22 @@ LL + /// Should warn when doc comment uses double space\
2020LL + /// as a line-break, even when there are multiple\
2121 |
2222
23- error: aborting due to 2 previous errors
23+ error: doc comments should use a back-slash (\) instead of a double space to indicate a linebreak
24+ --> tests/ui/doc/doc_comment_double_space_linebreak.rs:44:1
25+ |
26+ LL | / /// 🌹 are 🟥
27+ LL | | /// 🌷 are 🟦
28+ LL | | /// 📎 is 😎
29+ LL | | /// and so are 🫵
30+ | |___________________^
31+ |
32+ help: replace this double space with a back-slash
33+ |
34+ LL ~ /// 🌹 are 🟥\
35+ LL ~ /// 🌷 are 🟦\
36+ LL ~ /// 📎 is 😎\
37+ LL ~ /// and so are 🫵\
38+ |
39+
40+ error: aborting due to 3 previous errors
2441
You can’t perform that action at this time.
0 commit comments