@@ -234,10 +234,6 @@ impl<'a, I: Iterator<Item = Event<'a>>> Iterator for CodeBlocks<'_, 'a, I> {
234
234
235
235
fn next ( & mut self ) -> Option < Self :: Item > {
236
236
let event = self . inner . next ( ) ;
237
- let compile_fail;
238
- let should_panic;
239
- let ignore;
240
- let edition;
241
237
let Some ( Event :: Start ( Tag :: CodeBlock ( kind) ) ) = event else {
242
238
return event;
243
239
} ;
@@ -253,49 +249,44 @@ impl<'a, I: Iterator<Item = Event<'a>>> Iterator for CodeBlocks<'_, 'a, I> {
253
249
}
254
250
}
255
251
256
- let parse_result = match kind {
257
- CodeBlockKind :: Fenced ( ref lang) => {
258
- let parse_result = LangString :: parse_without_check (
259
- lang,
260
- self . check_error_codes ,
261
- false ,
262
- self . custom_code_classes_in_docs ,
263
- ) ;
264
- if !parse_result. rust {
265
- let added_classes = parse_result. added_classes ;
266
- let lang_string = if let Some ( lang) = parse_result. unknown . first ( ) {
267
- format ! ( "language-{}" , lang)
268
- } else {
269
- String :: new ( )
270
- } ;
271
- let whitespace = if added_classes. is_empty ( ) { "" } else { " " } ;
272
- return Some ( Event :: Html (
273
- format ! (
274
- "<div class=\" example-wrap\" >\
252
+ let LangString { added_classes, compile_fail, should_panic, ignore, edition, .. } =
253
+ match kind {
254
+ CodeBlockKind :: Fenced ( ref lang) => {
255
+ let parse_result = LangString :: parse_without_check (
256
+ lang,
257
+ self . check_error_codes ,
258
+ false ,
259
+ self . custom_code_classes_in_docs ,
260
+ ) ;
261
+ if !parse_result. rust {
262
+ let added_classes = parse_result. added_classes ;
263
+ let lang_string = if let Some ( lang) = parse_result. unknown . first ( ) {
264
+ format ! ( "language-{}" , lang)
265
+ } else {
266
+ String :: new ( )
267
+ } ;
268
+ let whitespace = if added_classes. is_empty ( ) { "" } else { " " } ;
269
+ return Some ( Event :: Html (
270
+ format ! (
271
+ "<div class=\" example-wrap\" >\
275
272
<pre class=\" {lang_string}{whitespace}{added_classes}\" >\
276
273
<code>{text}</code>\
277
274
</pre>\
278
275
</div>",
279
- added_classes = added_classes. join( " " ) ,
280
- text = Escape ( & original_text) ,
281
- )
282
- . into ( ) ,
283
- ) ) ;
276
+ added_classes = added_classes. join( " " ) ,
277
+ text = Escape ( & original_text) ,
278
+ )
279
+ . into ( ) ,
280
+ ) ) ;
281
+ }
282
+ parse_result
284
283
}
285
- parse_result
286
- }
287
- CodeBlockKind :: Indented => Default :: default ( ) ,
288
- } ;
284
+ CodeBlockKind :: Indented => Default :: default ( ) ,
285
+ } ;
289
286
290
- let added_classes = parse_result. added_classes ;
291
287
let lines = original_text. lines ( ) . filter_map ( |l| map_line ( l) . for_html ( ) ) ;
292
288
let text = lines. intersperse ( "\n " . into ( ) ) . collect :: < String > ( ) ;
293
289
294
- compile_fail = parse_result. compile_fail ;
295
- should_panic = parse_result. should_panic ;
296
- ignore = parse_result. ignore ;
297
- edition = parse_result. edition ;
298
-
299
290
let explicit_edition = edition. is_some ( ) ;
300
291
let edition = edition. unwrap_or ( self . edition ) ;
301
292
0 commit comments