@@ -251,7 +251,7 @@ impl<'a, I: Iterator<Item = Event<'a>>> Iterator for CodeBlocks<'_, 'a, I> {
251251 }
252252 }
253253 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 > ( ) ;
255255
256256 let parse_result = match kind {
257257 CodeBlockKind :: Fenced ( ref lang) => {
@@ -291,15 +291,13 @@ impl<'a, I: Iterator<Item = Event<'a>>> Iterator for CodeBlocks<'_, 'a, I> {
291291 let test = origtext
292292 . lines ( )
293293 . map ( |l| map_line ( l) . for_code ( ) )
294- . collect :: < Vec < Cow < ' _ , str > > > ( )
295- . join ( " \n " ) ;
294+ . intersperse ( " \n " . into ( ) )
295+ . collect :: < String > ( ) ;
296296 let krate = krate. as_ref ( ) . map ( |s| & * * s) ;
297297 let ( test, _, _) =
298298 doctest:: make_test ( & test, krate, false , & Default :: default ( ) , edition, None ) ;
299299 let channel = if test. contains ( "#![feature(" ) { "&version=nightly" } else { "" } ;
300300
301- let edition_string = format ! ( "&edition={}" , edition) ;
302-
303301 // These characters don't need to be escaped in a URI.
304302 // FIXME: use a library function for percent encoding.
305303 fn dont_escape ( c : u8 ) -> bool {
@@ -325,8 +323,8 @@ impl<'a, I: Iterator<Item = Event<'a>>> Iterator for CodeBlocks<'_, 'a, I> {
325323 }
326324 }
327325 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 ,
330328 ) )
331329 } ) ;
332330
0 commit comments