Skip to content

Commit 22c9940

Browse files
committed
Add tests for allowed non-backticked identifiers in doc
1 parent b304221 commit 22c9940

File tree

2 files changed

+38
-25
lines changed

2 files changed

+38
-25
lines changed

tests/ui/doc.rs

+10-3
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,16 @@ fn test_emphasis() {
4949
fn test_units() {
5050
}
5151

52+
/// This tests allowed identifiers.
53+
/// DirectX
54+
/// ECMAScript
55+
/// OAuth GraphQL
56+
/// TeX LaTeX BibTeX BibLaTeX
57+
/// CamelCase (see also #2395)
58+
/// be_sure_we_got_to_the_end_of_it
59+
fn test_allowed() {
60+
}
61+
5262
/// This test has [a link_with_underscores][chunked-example] inside it. See #823.
5363
/// See also [the issue tracker](https://github.com/rust-lang/rust-clippy/search?q=clippy::doc_markdown&type=Issues)
5464
/// on GitHub (which is a camel-cased word, but is OK). And here is another [inline link][inline_link].
@@ -168,9 +178,6 @@ fn issue_1920() {}
168178
/// Not ok: http://www.unicode.org/reports/tr9/#Reordering_Resolved_Levels
169179
fn issue_1832() {}
170180

171-
/// Ok: CamelCase (It should not be surrounded by backticks)
172-
fn issue_2395() {}
173-
174181
/// An iterator over mycrate::Collection's values.
175182
/// It should not lint a `'static` lifetime in ticks.
176183
fn issue_2210() {}

tests/ui/doc.stderr

+28-22
Original file line numberDiff line numberDiff line change
@@ -54,131 +54,137 @@ error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the doc
5454
LL | /// be_sure_we_got_to_the_end_of_it
5555
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5656

57+
error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
58+
--> $DIR/doc.rs:58:5
59+
|
60+
LL | /// be_sure_we_got_to_the_end_of_it
61+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
62+
5763
error: you should put `link_with_underscores` between ticks in the documentation
58-
--> $DIR/doc.rs:52:22
64+
--> $DIR/doc.rs:62:22
5965
|
6066
LL | /// This test has [a link_with_underscores][chunked-example] inside it. See #823.
6167
| ^^^^^^^^^^^^^^^^^^^^^
6268

6369
error: you should put `inline_link2` between ticks in the documentation
64-
--> $DIR/doc.rs:55:21
70+
--> $DIR/doc.rs:65:21
6571
|
6672
LL | /// It can also be [inline_link2].
6773
| ^^^^^^^^^^^^
6874

6975
error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
70-
--> $DIR/doc.rs:65:5
76+
--> $DIR/doc.rs:75:5
7177
|
7278
LL | /// be_sure_we_got_to_the_end_of_it
7379
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7480

7581
error: you should put `CamelCaseThing` between ticks in the documentation
76-
--> $DIR/doc.rs:73:8
82+
--> $DIR/doc.rs:83:8
7783
|
7884
LL | /// ## CamelCaseThing
7985
| ^^^^^^^^^^^^^^
8086

8187
error: you should put `CamelCaseThing` between ticks in the documentation
82-
--> $DIR/doc.rs:76:7
88+
--> $DIR/doc.rs:86:7
8389
|
8490
LL | /// # CamelCaseThing
8591
| ^^^^^^^^^^^^^^
8692

8793
error: you should put `CamelCaseThing` between ticks in the documentation
88-
--> $DIR/doc.rs:78:22
94+
--> $DIR/doc.rs:88:22
8995
|
9096
LL | /// Not a title #897 CamelCaseThing
9197
| ^^^^^^^^^^^^^^
9298

9399
error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
94-
--> $DIR/doc.rs:79:5
100+
--> $DIR/doc.rs:89:5
95101
|
96102
LL | /// be_sure_we_got_to_the_end_of_it
97103
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
98104

99105
error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
100-
--> $DIR/doc.rs:86:5
106+
--> $DIR/doc.rs:96:5
101107
|
102108
LL | /// be_sure_we_got_to_the_end_of_it
103109
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
104110

105111
error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
106-
--> $DIR/doc.rs:99:5
112+
--> $DIR/doc.rs:109:5
107113
|
108114
LL | /// be_sure_we_got_to_the_end_of_it
109115
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
110116

111117
error: you should put `FooBar` between ticks in the documentation
112-
--> $DIR/doc.rs:110:43
118+
--> $DIR/doc.rs:120:43
113119
|
114120
LL | /** E.g., serialization of an empty list: FooBar
115121
| ^^^^^^
116122

117123
error: you should put `BarQuz` between ticks in the documentation
118-
--> $DIR/doc.rs:115:5
124+
--> $DIR/doc.rs:125:5
119125
|
120126
LL | And BarQuz too.
121127
| ^^^^^^
122128

123129
error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
124-
--> $DIR/doc.rs:116:1
130+
--> $DIR/doc.rs:126:1
125131
|
126132
LL | be_sure_we_got_to_the_end_of_it
127133
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
128134

129135
error: you should put `FooBar` between ticks in the documentation
130-
--> $DIR/doc.rs:121:43
136+
--> $DIR/doc.rs:131:43
131137
|
132138
LL | /** E.g., serialization of an empty list: FooBar
133139
| ^^^^^^
134140

135141
error: you should put `BarQuz` between ticks in the documentation
136-
--> $DIR/doc.rs:126:5
142+
--> $DIR/doc.rs:136:5
137143
|
138144
LL | And BarQuz too.
139145
| ^^^^^^
140146

141147
error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
142-
--> $DIR/doc.rs:127:1
148+
--> $DIR/doc.rs:137:1
143149
|
144150
LL | be_sure_we_got_to_the_end_of_it
145151
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
146152

147153
error: you should put `be_sure_we_got_to_the_end_of_it` between ticks in the documentation
148-
--> $DIR/doc.rs:138:5
154+
--> $DIR/doc.rs:148:5
149155
|
150156
LL | /// be_sure_we_got_to_the_end_of_it
151157
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
152158

153159
error: you should put bare URLs between `<`/`>` or make a proper Markdown link
154-
--> $DIR/doc.rs:165:13
160+
--> $DIR/doc.rs:175:13
155161
|
156162
LL | /// Not ok: http://www.unicode.org
157163
| ^^^^^^^^^^^^^^^^^^^^^^
158164

159165
error: you should put bare URLs between `<`/`>` or make a proper Markdown link
160-
--> $DIR/doc.rs:166:13
166+
--> $DIR/doc.rs:176:13
161167
|
162168
LL | /// Not ok: https://www.unicode.org
163169
| ^^^^^^^^^^^^^^^^^^^^^^^
164170

165171
error: you should put bare URLs between `<`/`>` or make a proper Markdown link
166-
--> $DIR/doc.rs:167:13
172+
--> $DIR/doc.rs:177:13
167173
|
168174
LL | /// Not ok: http://www.unicode.org/
169175
| ^^^^^^^^^^^^^^^^^^^^^^
170176

171177
error: you should put bare URLs between `<`/`>` or make a proper Markdown link
172-
--> $DIR/doc.rs:168:13
178+
--> $DIR/doc.rs:178:13
173179
|
174180
LL | /// Not ok: http://www.unicode.org/reports/tr9/#Reordering_Resolved_Levels
175181
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
176182

177183
error: you should put `mycrate::Collection` between ticks in the documentation
178-
--> $DIR/doc.rs:174:22
184+
--> $DIR/doc.rs:181:22
179185
|
180186
LL | /// An iterator over mycrate::Collection's values.
181187
| ^^^^^^^^^^^^^^^^^^^
182188

183-
error: aborting due to 30 previous errors
189+
error: aborting due to 31 previous errors
184190

0 commit comments

Comments
 (0)