Skip to content

Commit a96c556

Browse files
committed
add tests for spurious failure and fix typo
1 parent 6914ef3 commit a96c556

File tree

4 files changed

+63
-21
lines changed

4 files changed

+63
-21
lines changed

src/tools/clippy/tests/ui/doc/unbalanced_ticks.rs

+17
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,20 @@ fn escape_3() {}
6666

6767
/// Backslashes ` \` within code blocks don't count.
6868
fn escape_4() {}
69+
70+
trait Foo {
71+
fn bar();
72+
}
73+
74+
struct Bar;
75+
impl Foo for Bar {
76+
// NOTE: false positive
77+
/// Returns an `Option<Month>` from a i64, assuming a 1-index, January = 1.
78+
///
79+
/// `Month::from_i64(n: i64)`: | `1` | `2` | ... | `12`
80+
/// ---------------------------| -------------------- | --------------------- | ... | -----
81+
/// ``: | Some(Month::January) | Some(Month::February) | ... |
82+
/// Some(Month::December)
83+
84+
fn bar() {}
85+
}

src/tools/clippy/tests/ui/doc/unbalanced_ticks.stderr

+26-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
error: empty line after doc comment
2+
--> tests/ui/doc/unbalanced_ticks.rs:82:5
3+
|
4+
LL | / /// Some(Month::December)
5+
LL | |
6+
| |_^
7+
LL | fn bar() {}
8+
| ------ the comment documents this function
9+
|
10+
= note: `-D clippy::empty-line-after-doc-comments` implied by `-D warnings`
11+
= help: to override `-D warnings` add `#[allow(clippy::empty_line_after_doc_comments)]`
12+
= help: if the empty line is unintentional, remove it
13+
114
error: backticks are unbalanced
215
--> tests/ui/doc/unbalanced_ticks.rs:7:5
316
|
@@ -94,5 +107,17 @@ LL | /// Escaped \` ` backticks don't count, but unescaped backticks do.
94107
|
95108
= help: a backtick may be missing a pair
96109

97-
error: aborting due to 10 previous errors
110+
error: backticks are unbalanced
111+
--> tests/ui/doc/unbalanced_ticks.rs:79:9
112+
|
113+
LL | /// `Month::from_i64(n: i64)`: | `1` | `2` | ... | `12`
114+
| _________^
115+
LL | | /// ---------------------------| -------------------- | --------------------- | ... | -----
116+
LL | | /// ``: | Some(Month::January) | Some(Month::February) | ... |
117+
LL | | /// Some(Month::December)
118+
| |_____________________________^
119+
|
120+
= help: a backtick may be missing a pair
121+
122+
error: aborting due to 12 previous errors
98123

src/tools/clippy/tests/ui/empty_line_after/doc_comments.stderr

+11-11
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ LL | fn first_in_crate() {}
99
|
1010
= note: `-D clippy::empty-line-after-doc-comments` implied by `-D warnings`
1111
= help: to override `-D warnings` add `#[allow(clippy::empty_line_after_doc_comments)]`
12-
= help: if the empty line is unintentional remove it
12+
= help: if the empty line is unintentional, remove it
1313
help: if the comment should document the crate use an inner doc comment
1414
|
1515
LL ~ //! Meant to be an
@@ -26,7 +26,7 @@ LL | |
2626
LL | fn first_in_module() {}
2727
| ------------------ the comment documents this function
2828
|
29-
= help: if the empty line is unintentional remove it
29+
= help: if the empty line is unintentional, remove it
3030
help: if the comment should document the parent module use an inner doc comment
3131
|
3232
LL ~ //! Meant to be an
@@ -44,7 +44,7 @@ LL | /// Blank line
4444
LL | fn indented() {}
4545
| ----------- the comment documents this function
4646
|
47-
= help: if the empty line is unintentional remove it
47+
= help: if the empty line is unintentional, remove it
4848
help: if the documentation should include the empty line include it in the comment
4949
|
5050
LL | ///
@@ -59,7 +59,7 @@ LL | |
5959
LL | fn with_doc_and_newline() {}
6060
| ----------------------- the comment documents this function
6161
|
62-
= help: if the empty line is unintentional remove it
62+
= help: if the empty line is unintentional, remove it
6363

6464
error: empty lines after doc comment
6565
--> tests/ui/empty_line_after/doc_comments.rs:44:1
@@ -74,7 +74,7 @@ LL | |
7474
LL | fn three_attributes() {}
7575
| ------------------- the comment documents this function
7676
|
77-
= help: if the empty lines are unintentional remove them
77+
= help: if the empty lines are unintentional, remove them
7878

7979
error: empty line after doc comment
8080
--> tests/ui/empty_line_after/doc_comments.rs:56:5
@@ -86,7 +86,7 @@ LL | |
8686
LL | fn new_code() {}
8787
| ----------- the comment documents this function
8888
|
89-
= help: if the empty line is unintentional remove it
89+
= help: if the empty line is unintentional, remove it
9090
help: if the doc comment should not document `new_code` comment it out
9191
|
9292
LL | // /// docs for `old_code`
@@ -106,7 +106,7 @@ LL | |
106106
LL | struct Multiple;
107107
| --------------- the comment documents this struct
108108
|
109-
= help: if the empty lines are unintentional remove them
109+
= help: if the empty lines are unintentional, remove them
110110
help: if the doc comment should not document `Multiple` comment it out
111111
|
112112
LL ~ // /// Docs
@@ -128,7 +128,7 @@ LL | |
128128
LL | fn first_in_module() {}
129129
| ------------------ the comment documents this function
130130
|
131-
= help: if the empty line is unintentional remove it
131+
= help: if the empty line is unintentional, remove it
132132
help: if the comment should document the parent module use an inner doc comment
133133
|
134134
LL | /*!
@@ -147,7 +147,7 @@ LL | |
147147
LL | fn new_code() {}
148148
| ----------- the comment documents this function
149149
|
150-
= help: if the empty line is unintentional remove it
150+
= help: if the empty line is unintentional, remove it
151151
help: if the doc comment should not document `new_code` comment it out
152152
|
153153
LL - /**
@@ -165,7 +165,7 @@ LL | /// Docs for `new_code2`
165165
LL | fn new_code2() {}
166166
| ------------ the comment documents this function
167167
|
168-
= help: if the empty line is unintentional remove it
168+
= help: if the empty line is unintentional, remove it
169169
help: if the doc comment should not document `new_code2` comment it out
170170
|
171171
LL | // /// Docs for `old_code2`
@@ -180,7 +180,7 @@ LL | |
180180
LL | fn bar() {}
181181
| ------ the comment documents this function
182182
|
183-
= help: if the empty line is unintentional remove it
183+
= help: if the empty line is unintentional, remove it
184184

185185
error: aborting due to 11 previous errors
186186

src/tools/clippy/tests/ui/empty_line_after/outer_attribute.stderr

+9-9
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ LL | fn first_in_crate() {}
99
|
1010
= note: `-D clippy::empty-line-after-outer-attr` implied by `-D warnings`
1111
= help: to override `-D warnings` add `#[allow(clippy::empty_line_after_outer_attr)]`
12-
= help: if the empty line is unintentional remove it
12+
= help: if the empty line is unintentional, remove it
1313
help: if the attribute should apply to the crate use an inner attribute
1414
|
1515
LL | #![crate_type = "lib"]
@@ -25,7 +25,7 @@ LL | /// some comment
2525
LL | fn with_one_newline_and_comment() {}
2626
| ------------------------------- the attribute applies to this function
2727
|
28-
= help: if the empty line is unintentional remove it
28+
= help: if the empty line is unintentional, remove it
2929

3030
error: empty line after outer attribute
3131
--> tests/ui/empty_line_after/outer_attribute.rs:23:1
@@ -36,7 +36,7 @@ LL | |
3636
LL | fn with_one_newline() {}
3737
| ------------------- the attribute applies to this function
3838
|
39-
= help: if the empty line is unintentional remove it
39+
= help: if the empty line is unintentional, remove it
4040

4141
error: empty lines after outer attribute
4242
--> tests/ui/empty_line_after/outer_attribute.rs:30:5
@@ -48,7 +48,7 @@ LL | |
4848
LL | fn with_two_newlines() {}
4949
| -------------------- the attribute applies to this function
5050
|
51-
= help: if the empty lines are unintentional remove them
51+
= help: if the empty lines are unintentional, remove them
5252
help: if the attribute should apply to the parent module use an inner attribute
5353
|
5454
LL | #![crate_type = "lib"]
@@ -63,7 +63,7 @@ LL | |
6363
LL | enum Baz {
6464
| -------- the attribute applies to this enum
6565
|
66-
= help: if the empty line is unintentional remove it
66+
= help: if the empty line is unintentional, remove it
6767

6868
error: empty line after outer attribute
6969
--> tests/ui/empty_line_after/outer_attribute.rs:45:1
@@ -74,7 +74,7 @@ LL | |
7474
LL | struct Foo {
7575
| ---------- the attribute applies to this struct
7676
|
77-
= help: if the empty line is unintentional remove it
77+
= help: if the empty line is unintentional, remove it
7878

7979
error: empty line after outer attribute
8080
--> tests/ui/empty_line_after/outer_attribute.rs:53:1
@@ -85,7 +85,7 @@ LL | |
8585
LL | mod foo {}
8686
| ------- the attribute applies to this module
8787
|
88-
= help: if the empty line is unintentional remove it
88+
= help: if the empty line is unintentional, remove it
8989

9090
error: empty line after outer attribute
9191
--> tests/ui/empty_line_after/outer_attribute.rs:58:1
@@ -97,7 +97,7 @@ LL | |
9797
LL | fn comment_before_empty_line() {}
9898
| ---------------------------- the attribute applies to this function
9999
|
100-
= help: if the empty line is unintentional remove it
100+
= help: if the empty line is unintentional, remove it
101101

102102
error: empty lines after outer attribute
103103
--> tests/ui/empty_line_after/outer_attribute.rs:64:1
@@ -109,7 +109,7 @@ LL | |
109109
LL | pub fn isolated_comment() {}
110110
| ----------------------- the attribute applies to this function
111111
|
112-
= help: if the empty lines are unintentional remove them
112+
= help: if the empty lines are unintentional, remove them
113113

114114
error: aborting due to 9 previous errors
115115

0 commit comments

Comments
 (0)