From 9413d943f193f6722f27a422ea46bc9bac030453 Mon Sep 17 00:00:00 2001 From: Tanishq Date: Fri, 5 Apr 2024 20:48:30 +0530 Subject: [PATCH] Fix link check report inconsistency (#2472) * Fix link check report inconsistency * Fix formatting issue --------- Co-authored-by: Tanishq --- components/site/src/link_checking.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/components/site/src/link_checking.rs b/components/site/src/link_checking.rs index 1bb1a66941..c7e4678195 100644 --- a/components/site/src/link_checking.rs +++ b/components/site/src/link_checking.rs @@ -178,13 +178,15 @@ pub fn check_external_links(site: &Site) -> Vec { } } + // Get unique links count from Vec by creating a temporary HashSet. + let unique_links_count = HashSet::<&str>::from_iter( + checked_links.iter().map(|link_def| link_def.external_link.as_str()), + ) + .len(); + println!( "Checking {} external link(s). Skipping {} external link(s).{}", - // Get unique links count from Vec by creating a temporary HashSet. - HashSet::<&str>::from_iter( - checked_links.iter().map(|link_def| link_def.external_link.as_str()) - ) - .len(), + unique_links_count, skipped_link_count, if invalid_url_links == 0 { "".to_string() @@ -272,7 +274,7 @@ pub fn check_external_links(site: &Site) -> Vec { println!( "> Checked {} external link(s): {} error(s) found.", - checked_links.len(), + unique_links_count, errors.len() );