@@ -251,7 +251,7 @@ impl<'a, I: Iterator<Item = Event<'a>>> Iterator for CodeBlocks<'_, 'a, I> {
251
251
}
252
252
}
253
253
let lines = origtext. lines ( ) . filter_map ( |l| map_line ( l) . for_html ( ) ) ;
254
- let text = lines. collect :: < Vec < Cow < ' _ , str > > > ( ) . join ( " \n " ) ;
254
+ let text = lines. intersperse ( " \n " . into ( ) ) . collect :: < String > ( ) ;
255
255
256
256
let parse_result = match kind {
257
257
CodeBlockKind :: Fenced ( ref lang) => {
@@ -291,15 +291,13 @@ impl<'a, I: Iterator<Item = Event<'a>>> Iterator for CodeBlocks<'_, 'a, I> {
291
291
let test = origtext
292
292
. lines ( )
293
293
. map ( |l| map_line ( l) . for_code ( ) )
294
- . collect :: < Vec < Cow < ' _ , str > > > ( )
295
- . join ( " \n " ) ;
294
+ . intersperse ( " \n " . into ( ) )
295
+ . collect :: < String > ( ) ;
296
296
let krate = krate. as_ref ( ) . map ( |s| & * * s) ;
297
297
let ( test, _, _) =
298
298
doctest:: make_test ( & test, krate, false , & Default :: default ( ) , edition, None ) ;
299
299
let channel = if test. contains ( "#![feature(" ) { "&version=nightly" } else { "" } ;
300
300
301
- let edition_string = format ! ( "&edition={}" , edition) ;
302
-
303
301
// These characters don't need to be escaped in a URI.
304
302
// FIXME: use a library function for percent encoding.
305
303
fn dont_escape ( c : u8 ) -> bool {
@@ -325,8 +323,8 @@ impl<'a, I: Iterator<Item = Event<'a>>> Iterator for CodeBlocks<'_, 'a, I> {
325
323
}
326
324
}
327
325
Some ( format ! (
328
- r#"<a class="test-arrow" target="_blank" href="{}?code={}{}{}">Run</a>"# ,
329
- url, test_escaped, channel, edition_string
326
+ r#"<a class="test-arrow" target="_blank" href="{}?code={}{}&edition= {}">Run</a>"# ,
327
+ url, test_escaped, channel, edition ,
330
328
) )
331
329
} ) ;
332
330
0 commit comments