From d615aa28430bca4ab64a6e737be4d2bce6c70d55 Mon Sep 17 00:00:00 2001 From: Bauke Date: Sat, 24 Jun 2023 11:05:17 +0200 Subject: [PATCH] Refactor the main user count chart copying into a loop. --- source/cli/run.rs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/source/cli/run.rs b/source/cli/run.rs index 772b7b8..7f46887 100644 --- a/source/cli/run.rs +++ b/source/cli/run.rs @@ -136,16 +136,12 @@ pub async fn run() -> Result<()> { write_assets(&output).await?; if let Some(group) = user_count_group { - let path = - output.join(&format!("charts/user-count/{}.svg", &group.name)); - copy(path, output.join("charts/main-user-count.svg")).await?; - - let path = output.join(&format!( - "charts-untruncated/user-count/{}.svg", - &group.name - )); - copy(path, output.join("charts-untruncated/main-user-count.svg")) - .await?; + for dir in ["charts", "charts-untruncated"] { + let from_path = + output.join(&format!("{}/user-count/{}.svg", dir, &group.name)); + let to_path = output.join(format!("{}/main-user-count.svg", dir)); + copy(from_path, to_path).await?; + } } } },