From 0764c004224e1c7b8b3bb69370c7925a05fc7d73 Mon Sep 17 00:00:00 2001 From: Henil <71698300+henil@users.noreply.github.com> Date: Mon, 26 Oct 2020 23:10:45 +0530 Subject: [PATCH] Show number of outdated dependencies even if insecure crates are present (#73) * Update to show number of outdated dependencies even if insecure crates are present * add match statement to simplify if-else statment --- src/server/views/html/status.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/server/views/html/status.rs b/src/server/views/html/status.rs index f3044c1..9f5c027 100644 --- a/src/server/views/html/status.rs +++ b/src/server/views/html/status.rs @@ -41,13 +41,12 @@ fn dependency_table(title: &str, deps: IndexMap) html! { h3 class="title is-4" { (title) } p class="subtitle is-5" { - @if count_insecure > 0 { - (format!(" ({} total, {} insecure)", count_total, count_insecure)) - } @else if count_outdated > 0 { - (format!(" ({} total, {} up-to-date, {} outdated)", count_total, count_total - count_outdated, count_outdated)) - } @else { - (format!(" ({} total, all up-to-date)", count_total)) - } + (match (count_outdated, count_insecure) { + (0, 0) => format!("({} total, all up-to-date)", count_total), + (0, _) => format!("({} total, {} insecure)", count_total, count_insecure), + (_, 0) => format!("({} total, {} outdated)", count_total, count_outdated), + (_, _) => format!("({} total, {} outdated, {} insecure)", count_total, count_outdated, count_insecure), + }) } table class="table is-fullwidth is-striped is-hoverable" {