From f5e070cdf6628a5ebd981d373929802317104e24 Mon Sep 17 00:00:00 2001 From: fxqnlr Date: Wed, 4 Sep 2024 09:56:42 +0200 Subject: clippy --fix --- src/commands/download.rs | 2 +- src/commands/io.rs | 8 ++++---- src/commands/list.rs | 20 +++++++++----------- src/commands/modification.rs | 12 ++++++------ 4 files changed, 20 insertions(+), 22 deletions(-) (limited to 'src/commands') diff --git a/src/commands/download.rs b/src/commands/download.rs index a7cf744..3e50c87 100644 --- a/src/commands/download.rs +++ b/src/commands/download.rs @@ -71,7 +71,7 @@ pub async fn download( } if clean { - clean_list_dir(¤t_list)? + clean_list_dir(¤t_list)?; }; if !to_download.is_empty() { diff --git a/src/commands/io.rs b/src/commands/io.rs index 8e44b2b..1d17f7c 100644 --- a/src/commands/io.rs +++ b/src/commands/io.rs @@ -48,13 +48,13 @@ impl ExportList { let mut dl_folder = None; if download { - dl_folder = Some(list.download_folder) + dl_folder = Some(list.download_folder); }; let mods = userlist_get_all_ids(config, list_id)?; let mut versions = vec![]; for m in mods { - versions.push(ExportVersion::from(config, list_id, &m)?) + versions.push(ExportVersion::from(config, list_id, &m)?); } Ok(Self { @@ -80,7 +80,7 @@ pub fn export(config: &Cfg, list: Option) -> MLE<()> { let mut lists: Vec = vec![]; for list_id in list_ids { - progress.set_message(format!("Export {}", list_id)); + progress.set_message(format!("Export {list_id}")); //TODO download option/ new download on import lists.push(ExportList::from(config, &list_id, true)?); } @@ -97,7 +97,7 @@ pub fn export(config: &Cfg, list: Option) -> MLE<()> { progress.set_message("Create file"); let mut file = File::create(&filestr)?; file.write_all(toml.as_bytes())?; - progress.finish_with_message(format!("Exported to {}", filestr)); + progress.finish_with_message(format!("Exported to {filestr}")); Ok(()) } diff --git a/src/commands/list.rs b/src/commands/list.rs index 3665446..63105cf 100644 --- a/src/commands/list.rs +++ b/src/commands/list.rs @@ -32,32 +32,32 @@ pub fn list_add( ) -> MLE<()> { let p = ProgressBar::new_spinner(); p.set_style(ProgressStyle::with_template(STYLE_OPERATION).unwrap()); - p.set_message(format!("Create {}", id)); + p.set_message(format!("Create {id}")); lists_insert(config, id, mc_version, modloader, directory)?; - p.finish_with_message(format!("Created {}", id)); + p.finish_with_message(format!("Created {id}")); Ok(()) } pub fn list_change(config: &Cfg, id: &str) -> MLE<()> { let p = ProgressBar::new_spinner(); p.set_style(ProgressStyle::with_template(STYLE_OPERATION).unwrap()); - p.set_message(format!("Change default list to {}", id)); + p.set_message(format!("Change default list to {id}")); if !lists_get_all_ids(config)?.into_iter().any(|l| l == id) { return Err(MLError::new(ErrorType::ArgumentError, "List not found")); }; config_change_current_list(config, id)?; - p.finish_with_message(format!("Changed default list to {}", id)); + p.finish_with_message(format!("Changed default list to {id}")); Ok(()) } pub fn list_remove(config: &Cfg, id: &str) -> MLE<()> { let p = ProgressBar::new_spinner(); p.set_style(ProgressStyle::with_template(STYLE_OPERATION).unwrap()); - p.set_message(format!("Remove {}", id)); + p.set_message(format!("Remove {id}")); lists_remove(config, id)?; - p.finish_with_message(format!("Removed {}", id)); + p.finish_with_message(format!("Removed {id}")); Ok(()) } @@ -77,15 +77,13 @@ pub async fn list_version( let p = ProgressBar::new_spinner(); p.set_style(ProgressStyle::with_template(STYLE_OPERATION).unwrap()); p.set_message(format!( - "Change version for list {} to minecraft version: {}", - id, mc_version + "Change version for list {id} to minecraft version: {mc_version}" )); lists_version(config, id, &mc_version)?; p.finish_with_message(format!( - "Changed version for list {} to minecraft version: {}", - id, mc_version + "Changed version for list {id} to minecraft version: {mc_version}" )); let list = lists_get(config, id)?; @@ -96,7 +94,7 @@ pub fn list_list(config: &Cfg) -> MLE<()> { let lists = lists_get_all_ids(config)?; for list in lists { let l = lists_get(config, &list)?; - println!("{}: | {} | {}", l.id, l.mc_version, l.modloader) + println!("{}: | {} | {}", l.id, l.mc_version, l.modloader); } Ok(()) } diff --git a/src/commands/modification.rs b/src/commands/modification.rs index 4488b70..e0e54b2 100644 --- a/src/commands/modification.rs +++ b/src/commands/modification.rs @@ -65,7 +65,7 @@ pub async fn mod_add( add_p.inc(1); match m.id { IDSelector::ModificationID(pid) => { - mod_ids.push((pid, m.set_version)) + mod_ids.push((pid, m.set_version)); } IDSelector::VersionID(vid) => ver_ids.push((vid, m.set_version)), } @@ -153,7 +153,7 @@ pub async fn mod_add( }?; if project.current_version.is_some() { - downloadstack.push(project.current_version.unwrap()) + downloadstack.push(project.current_version.unwrap()); }; project_p.inc(1); @@ -245,7 +245,7 @@ async fn get_mod_infos( applicable_versions: available_versions_vec, download_link: file, set_version: *setmap.get(&project.slug).unwrap(), - }) + }); } else { current_version = None; file = String::from("NONE"); @@ -258,7 +258,7 @@ async fn get_mod_infos( applicable_versions: available_versions_vec, download_link: file, set_version: *setmap.get(&project.id).unwrap(), - }) + }); } } @@ -308,7 +308,7 @@ async fn get_ver_info( applicable_versions: vec![String::from(&version.id)], download_link: file, set_version: *setmap.get(&version.id).unwrap(), - }) + }); } Ok(projectinfo) } @@ -335,7 +335,7 @@ pub fn mod_remove(config: &Cfg, id: &str, list: &List) -> MLE<()> { progress.set_message("Delete file"); match delete_version(list, version) { - Ok(_) => (), + Ok(()) => (), Err(err) => { if err.to_string() != "User input not accepted: VERSION_NOT_FOUND_IN_FILES" -- cgit v1.2.3