]> git.lizzy.rs Git - rust.git/commitdiff
Show line even if there is no code examples
authorGuillaume Gomez <guillaume1.gomez@gmail.com>
Fri, 21 Aug 2020 14:43:04 +0000 (16:43 +0200)
committerGuillaume Gomez <guillaume1.gomez@gmail.com>
Fri, 21 Aug 2020 14:43:04 +0000 (16:43 +0200)
src/librustdoc/passes/calculate_doc_coverage.rs

index 6b653f87de9021e5c2aa7cd4ccc3443a20348521..457359e7a3806f20746823b7dcd02011929f9c7a 100644 (file)
@@ -27,7 +27,7 @@ fn calculate_doc_coverage(krate: clean::Crate, ctx: &DocContext<'_>) -> clean::C
     krate
 }
 
-#[derive(Default, Copy, Clone, Serialize)]
+#[derive(Default, Copy, Clone, Serialize, Debug)]
 struct ItemCount {
     total: u64,
     with_docs: u64,
@@ -155,14 +155,12 @@ fn print_table_record(
         print_table_line();
 
         for (file, &count) in &self.items {
-            if let (Some(percentage), Some(examples_percentage)) =
-                (count.percentage(), count.examples_percentage())
-            {
+            if let Some(percentage) = count.percentage() {
                 print_table_record(
                     &limit_filename_len(file.to_string()),
                     count,
                     percentage,
-                    examples_percentage,
+                    count.examples_percentage().unwrap_or(0.),
                 );
 
                 total += count;