@@ -429,10 +429,8 @@ impl RustwideBuilder {
429
429
algs,
430
430
) ?;
431
431
432
- if let ( Some ( total) , Some ( documented) ) =
433
- ( res. result . total_items , res. result . documented_items )
434
- {
435
- add_doc_coverage ( & mut conn, release_id, total, documented) ?;
432
+ if let Some ( doc_coverage) = res. result . doc_coverage {
433
+ add_doc_coverage ( & mut conn, release_id, doc_coverage) ?;
436
434
}
437
435
438
436
add_build_into_database ( & mut conn, release_id, & res. result ) ?;
@@ -648,14 +646,15 @@ impl RustwideBuilder {
648
646
. run ( )
649
647
. is_ok ( )
650
648
} ) ;
651
- let mut total_items = None ;
652
- let mut documented_items = None ;
649
+ let mut doc_coverage = None ;
653
650
if successful {
654
- if let Some ( ( total , documented ) ) =
651
+ if let Some ( ( total_items , documented_items ) ) =
655
652
self . get_coverage ( target, build, metadata, limits) ?
656
653
{
657
- total_items = Some ( total) ;
658
- documented_items = Some ( documented) ;
654
+ doc_coverage = Some ( DocCoverage {
655
+ total_items,
656
+ documented_items,
657
+ } ) ;
659
658
}
660
659
}
661
660
// If we're passed a default_target which requires a cross-compile,
@@ -677,8 +676,7 @@ impl RustwideBuilder {
677
676
rustc_version : self . rustc_version . clone ( ) ,
678
677
docsrs_version : format ! ( "docsrs {}" , crate :: BUILD_VERSION ) ,
679
678
successful,
680
- total_items,
681
- documented_items,
679
+ doc_coverage
682
680
} ,
683
681
cargo_metadata,
684
682
target : target. to_string ( ) ,
@@ -732,14 +730,19 @@ struct FullBuildResult {
732
730
cargo_metadata : CargoMetadata ,
733
731
}
734
732
733
+ #[ derive( Clone , Copy ) ]
734
+ pub ( crate ) struct DocCoverage {
735
+ /// The total items that could be documented in the current crate, used to calculate
736
+ /// documentation coverage.
737
+ pub ( crate ) total_items : i32 ,
738
+ /// The items of the crate that are documented, used to calculate documentation coverage.
739
+ pub ( crate ) documented_items : i32 ,
740
+ }
741
+
735
742
pub ( crate ) struct BuildResult {
736
743
pub ( crate ) rustc_version : String ,
737
744
pub ( crate ) docsrs_version : String ,
738
745
pub ( crate ) build_log : String ,
739
746
pub ( crate ) successful : bool ,
740
- /// The total items that could be documented in the current crate, used to calculate
741
- /// documentation coverage.
742
- pub ( crate ) total_items : Option < i32 > ,
743
- /// The items of the crate that are documented, used to calculate documentation coverage.
744
- pub ( crate ) documented_items : Option < i32 > ,
747
+ pub ( crate ) doc_coverage : Option < DocCoverage > ,
745
748
}
0 commit comments