From c7ecf3019a75dc0ab1a0aefeb9b880899fc8a231 Mon Sep 17 00:00:00 2001 From: fxqnlr Date: Mon, 29 May 2023 18:01:12 +0200 Subject: cargo fmt and add fmt file --- src/commands/download.rs | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) (limited to 'src/commands/download.rs') diff --git a/src/commands/download.rs b/src/commands/download.rs index dd00ffb..a7cf744 100644 --- a/src/commands/download.rs +++ b/src/commands/download.rs @@ -5,7 +5,8 @@ use crate::{ db::userlist_get_all_current_versions_with_mods, error::{ErrorType, MLError, MLE}, files::{ - clean_list_dir, delete_version, disable_version, download_versions, get_downloaded_versions, + clean_list_dir, delete_version, disable_version, download_versions, + get_downloaded_versions, }, modrinth::get_raw_versions, }; @@ -18,7 +19,8 @@ pub async fn download( delete_old: bool, ) -> MLE<()> { let mp = MultiProgress::new(); - let download_p = mp.add(ProgressBar::new(liststack.len().try_into().unwrap())); + let download_p = + mp.add(ProgressBar::new(liststack.len().try_into().unwrap())); download_p.set_style( ProgressStyle::with_template(STYLE_BAR_POS) .unwrap() @@ -28,14 +30,19 @@ pub async fn download( for current_list in liststack { download_p.set_message(format!("Download in {}", current_list.id)); - let downloaded_versions = get_downloaded_versions(current_list.clone())?; - let current_version_ids = match userlist_get_all_current_versions_with_mods( - config, - String::from(¤t_list.id), - ) { - Ok(i) => Ok(i), - Err(e) => Err(MLError::new(ErrorType::DBError, e.to_string().as_str())), - }?; + let downloaded_versions = + get_downloaded_versions(current_list.clone())?; + let current_version_ids = + match userlist_get_all_current_versions_with_mods( + config, + String::from(¤t_list.id), + ) { + Ok(i) => Ok(i), + Err(e) => Err(MLError::new( + ErrorType::DBError, + e.to_string().as_str(), + )), + }?; let mut to_download: Vec = vec![]; //(mod_id, version_id) @@ -54,7 +61,10 @@ pub async fn download( .ok_or("SOMETHING_HAS_REALLY_GONE_WRONG") .unwrap(); if ¤t_version != downloaded_version { - to_disable.push((mod_id.clone(), String::from(downloaded_version))); + to_disable.push(( + mod_id.clone(), + String::from(downloaded_version), + )); to_download.push(current_version); } } @@ -98,7 +108,12 @@ pub async fn download( } else { d_p.set_message(format!("Disable version {}", ver.1)); d_p.inc(1); - disable_version(config, current_list.clone(), ver.1, ver.0)?; + disable_version( + config, + current_list.clone(), + ver.1, + ver.0, + )?; }; } -- cgit v1.2.3