File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -206,6 +206,15 @@ impl<'a> LintExtractor<'a> {
206
206
None => return Ok ( lints) ,
207
207
}
208
208
} ;
209
+
210
+ fn strip_prefix_and_suffix < ' a > (
211
+ line : & ' a str ,
212
+ prefix : & str ,
213
+ suffix : & str ,
214
+ ) -> Option < & ' a str > {
215
+ line. strip_prefix ( prefix) ?. strip_suffix ( suffix)
216
+ }
217
+
209
218
// Read the lint.
210
219
let mut doc_lines = Vec :: new ( ) ;
211
220
let ( doc, name) = loop {
@@ -216,6 +225,20 @@ impl<'a> LintExtractor<'a> {
216
225
doc_lines. push ( text. to_string ( ) ) ;
217
226
} else if line == "///" {
218
227
doc_lines. push ( "" . to_string ( ) ) ;
228
+ } else if let Some ( _) = strip_prefix_and_suffix (
229
+ line,
230
+ r##"#[cfg_attr(bootstrap, doc = ""## ,
231
+ r##"")]"## ,
232
+ ) {
233
+ // Ignore bootstrap-only parts of the doc comment.
234
+ continue ;
235
+ } else if let Some ( text) = strip_prefix_and_suffix (
236
+ line,
237
+ r##"#[cfg_attr(not(bootstrap), doc = ""## ,
238
+ r##"")]"## ,
239
+ ) {
240
+ // Include not-bootstrap parts of the doc comment.
241
+ doc_lines. push ( text. to_string ( ) )
219
242
} else if line. starts_with ( "// " ) {
220
243
// Ignore comments.
221
244
continue ;
You can’t perform that action at this time.
0 commit comments