@@ -286,60 +286,27 @@ impl<'a, I: Iterator<Item = Event<'a>>> Iterator for CodeBlocks<'_, 'a, I> {
286286 } ) ;
287287
288288 let tooltip = if ignore != Ignore :: None {
289- Some ( ( "This example is not tested" . to_owned ( ) , "ignore" ) )
289+ Some ( ( None , "ignore" ) )
290290 } else if compile_fail {
291- Some ( ( "This example deliberately fails to compile" . to_owned ( ) , "compile_fail" ) )
291+ Some ( ( None , "compile_fail" ) )
292292 } else if should_panic {
293- Some ( ( "This example panics" . to_owned ( ) , "should_panic" ) )
293+ Some ( ( None , "should_panic" ) )
294294 } else if explicit_edition {
295- Some ( ( format ! ( "This code runs with edition {}" , edition) , "edition" ) )
295+ Some ( ( Some ( edition) , "edition" ) )
296296 } else {
297297 None
298298 } ;
299299
300- if let Some ( ( s1, s2) ) = tooltip {
301- s. push_str ( & highlight:: render_with_highlighting (
302- text,
303- Some ( & format ! (
304- "rust-example-rendered{}" ,
305- if ignore != Ignore :: None {
306- " ignore"
307- } else if compile_fail {
308- " compile_fail"
309- } else if should_panic {
310- " should_panic"
311- } else if explicit_edition {
312- " edition "
313- } else {
314- ""
315- }
316- ) ) ,
317- playground_button. as_deref ( ) ,
318- Some ( ( s1. as_str ( ) , s2) ) ,
319- ) ) ;
320- Some ( Event :: Html ( s. into ( ) ) )
321- } else {
322- s. push_str ( & highlight:: render_with_highlighting (
323- text,
324- Some ( & format ! (
325- "rust-example-rendered{}" ,
326- if ignore != Ignore :: None {
327- " ignore"
328- } else if compile_fail {
329- " compile_fail"
330- } else if should_panic {
331- " should_panic"
332- } else if explicit_edition {
333- " edition "
334- } else {
335- ""
336- }
337- ) ) ,
338- playground_button. as_deref ( ) ,
339- None ,
340- ) ) ;
341- Some ( Event :: Html ( s. into ( ) ) )
342- }
300+ s. push_str ( & highlight:: render_with_highlighting (
301+ text,
302+ Some ( & format ! (
303+ "rust-example-rendered{}" ,
304+ if let Some ( ( _, class) ) = tooltip { format!( " {}" , class) } else { String :: new( ) }
305+ ) ) ,
306+ playground_button. as_deref ( ) ,
307+ tooltip,
308+ ) ) ;
309+ Some ( Event :: Html ( s. into ( ) ) )
343310 }
344311}
345312
0 commit comments