@@ -538,7 +538,7 @@ fn document(
538538 }
539539
540540 fmt:: from_fn ( move |f| {
541- document_item_info ( cx, item, parent) . render_into ( f) . unwrap ( ) ;
541+ document_item_info ( cx, item, parent) . render_into ( f) ? ;
542542 if parent. is_none ( ) {
543543 write ! ( f, "{}" , document_full_collapsible( item, cx, heading_offset) )
544544 } else {
@@ -582,7 +582,7 @@ fn document_short(
582582 show_def_docs : bool ,
583583) -> impl fmt:: Display {
584584 fmt:: from_fn ( move |f| {
585- document_item_info ( cx, item, Some ( parent) ) . render_into ( f) . unwrap ( ) ;
585+ document_item_info ( cx, item, Some ( parent) ) . render_into ( f) ? ;
586586 if !show_def_docs {
587587 return Ok ( ( ) ) ;
588588 }
@@ -661,7 +661,7 @@ fn document_full_inner(
661661 } ;
662662
663663 if let clean:: ItemKind :: FunctionItem ( ..) | clean:: ItemKind :: MethodItem ( ..) = kind {
664- render_call_locations ( f, cx, item) ;
664+ render_call_locations ( f, cx, item) ? ;
665665 }
666666 Ok ( ( ) )
667667 } )
@@ -2584,11 +2584,15 @@ const MAX_FULL_EXAMPLES: usize = 5;
25842584const NUM_VISIBLE_LINES : usize = 10 ;
25852585
25862586/// Generates the HTML for example call locations generated via the --scrape-examples flag.
2587- fn render_call_locations < W : fmt:: Write > ( mut w : W , cx : & Context < ' _ > , item : & clean:: Item ) {
2587+ fn render_call_locations < W : fmt:: Write > (
2588+ mut w : W ,
2589+ cx : & Context < ' _ > ,
2590+ item : & clean:: Item ,
2591+ ) -> fmt:: Result {
25882592 let tcx = cx. tcx ( ) ;
25892593 let def_id = item. item_id . expect_def_id ( ) ;
25902594 let key = tcx. def_path_hash ( def_id) ;
2591- let Some ( call_locations) = cx. shared . call_locations . get ( & key) else { return } ;
2595+ let Some ( call_locations) = cx. shared . call_locations . get ( & key) else { return Ok ( ( ) ) } ;
25922596
25932597 // Generate a unique ID so users can link to this section for a given method
25942598 let id = cx. derive_id ( "scraped-examples" ) ;
@@ -2602,8 +2606,7 @@ fn render_call_locations<W: fmt::Write>(mut w: W, cx: &Context<'_>, item: &clean
26022606 </h5>",
26032607 root_path = cx. root_path( ) ,
26042608 id = id
2605- )
2606- . unwrap ( ) ;
2609+ ) ?;
26072610
26082611 // Create a URL to a particular location in a reverse-dependency's source file
26092612 let link_to_loc = |call_data : & CallData , loc : & CallLocation | -> ( String , String ) {
@@ -2705,7 +2708,8 @@ fn render_call_locations<W: fmt::Write>(mut w: W, cx: &Context<'_>, item: &clean
27052708 title : init_title,
27062709 locations : locations_encoded,
27072710 } ) ,
2708- ) ;
2711+ )
2712+ . unwrap ( ) ;
27092713
27102714 true
27112715 } ;
@@ -2761,8 +2765,7 @@ fn render_call_locations<W: fmt::Write>(mut w: W, cx: &Context<'_>, item: &clean
27612765 <div class=\" hide-more\" >Hide additional examples</div>\
27622766 <div class=\" more-scraped-examples\" >\
27632767 <div class=\" toggle-line\" ><div class=\" toggle-line-inner\" ></div></div>"
2764- )
2765- . unwrap ( ) ;
2768+ ) ?;
27662769
27672770 // Only generate inline code for MAX_FULL_EXAMPLES number of examples. Otherwise we could
27682771 // make the page arbitrarily huge!
@@ -2774,23 +2777,21 @@ fn render_call_locations<W: fmt::Write>(mut w: W, cx: &Context<'_>, item: &clean
27742777 if it. peek ( ) . is_some ( ) {
27752778 w. write_str (
27762779 r#"<div class="example-links">Additional examples can be found in:<br><ul>"# ,
2777- )
2778- . unwrap ( ) ;
2779- it. for_each ( |( _, call_data) | {
2780+ ) ?;
2781+ it. try_for_each ( |( _, call_data) | {
27802782 let ( url, _) = link_to_loc ( call_data, & call_data. locations [ 0 ] ) ;
27812783 write ! (
27822784 w,
27832785 r#"<li><a href="{url}">{name}</a></li>"# ,
27842786 url = url,
27852787 name = call_data. display_name
27862788 )
2787- . unwrap ( ) ;
2788- } ) ;
2789- w. write_str ( "</ul></div>" ) . unwrap ( ) ;
2789+ } ) ?;
2790+ w. write_str ( "</ul></div>" ) ?;
27902791 }
27912792
2792- w. write_str ( "</div></details>" ) . unwrap ( ) ;
2793+ w. write_str ( "</div></details>" ) ? ;
27932794 }
27942795
2795- w. write_str ( "</div>" ) . unwrap ( ) ;
2796+ w. write_str ( "</div>" )
27962797}
0 commit comments