From 48393b209396db9ddd44251b2bb445d3ad7533fb Mon Sep 17 00:00:00 2001 From: fxqnlr Date: Thu, 25 May 2023 17:23:52 +0200 Subject: changed a whole lot og references, fuck rust --- src/main.rs | 56 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 31a320b..0e040b6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -162,7 +162,6 @@ async fn main() { match cli.command { Commands::Mod { command } => { match command { - #[allow(unused_variables)] ModCommands::Add { id, version, @@ -171,10 +170,10 @@ async fn main() { lock, } => { let listf = match list { - Some(list) => lists_get(config.clone(), list).unwrap(), + Some(list) => lists_get(&config, list).unwrap(), None => lists_get( - config.clone(), - config_get_current_list(config.clone()).unwrap(), + &config, + config_get_current_list(&config).unwrap(), ) .unwrap(), }; @@ -186,18 +185,18 @@ async fn main() { let add_id = AddMod { id: marked_id, set_version: lock }; - mod_add(config, vec![add_id], listf, download).await + mod_add(&config, vec![add_id], listf, download).await } ModCommands::Remove { id, list } => { let listf = match list { - Some(list) => lists_get(config.clone(), list).unwrap(), + Some(list) => lists_get(&config, list).unwrap(), None => lists_get( - config.clone(), - config_get_current_list(config.clone()).unwrap(), + &config, + config_get_current_list(&config).unwrap(), ) .unwrap(), }; - mod_remove(config, &id, listf) + mod_remove(&config, &id, listf) } } } @@ -211,28 +210,28 @@ async fn main() { } => { let ml = match modloader { Some(ml) => Modloader::from(&ml).unwrap(), - None => config.clone().defaults.modloader, + None => config.defaults.modloader.clone(), }; let versions_path = &config.versions; let ver = match version { Some(ver) => VersionLevel::from(&ver).get(versions_path, cli.force_gameupdate).await.unwrap(), - None => config.clone().defaults.version.get(versions_path, cli.force_gameupdate).await.unwrap(), + None => config.defaults.version.clone().get(versions_path, cli.force_gameupdate).await.unwrap(), }; - list_add(config, id, ver, ml, directory) + list_add(&config, &id, &ver, &ml, &directory) } - ListCommands::Remove { id } => list_remove(config, id), + ListCommands::Remove { id } => list_remove(&config, id), ListCommands::List => { - list_list(config) + list_list(&config) } - ListCommands::Change { id } => list_change(config, id), + ListCommands::Change { id } => list_change(&config, id), ListCommands::Version { id, version, download, remove, - } => list_version(config, id, version, download, remove).await, + } => list_version(&config, id, version, download, remove).await, } } Commands::Update { @@ -244,34 +243,35 @@ async fn main() { } => { let mut liststack: Vec = vec![]; if all { - let list_ids = lists_get_all_ids(config.clone()).unwrap(); + let list_ids = lists_get_all_ids(&config).unwrap(); for id in list_ids { - liststack.push(lists_get(config.clone(), id).unwrap()); + liststack.push(lists_get(&config, id).unwrap()); } } else { let current = match list { - Some(l) => lists_get(config.clone(), l).unwrap(), - None => get_current_list(config.clone()).unwrap(), + Some(l) => lists_get(&config, l).unwrap(), + None => get_current_list(&config).unwrap(), }; liststack.push(current) } - update(config, liststack, clean, download, remove).await + update(&config, liststack, clean, download, remove).await } Commands::Download { all, clean, remove, list } => { let mut liststack: Vec = vec![]; if all { - let list_ids = lists_get_all_ids(config.clone()).unwrap(); + let list_ids = lists_get_all_ids(&config).unwrap(); for id in list_ids { - liststack.push(lists_get(config.clone(), id).unwrap()); + liststack.push(lists_get(&config, id).unwrap()); } } else { let current = match list { - Some(l) => lists_get(config.clone(), l).unwrap(), - None => get_current_list(config.clone()).unwrap(), + Some(l) => lists_get(&config, l).unwrap(), + None => get_current_list(&config).unwrap(), }; liststack.push(current) } - download(config, liststack, clean, remove).await + + download(&config, liststack, clean, remove).await }, Commands::Import { file, download } => { let filestr: String = match file { @@ -284,9 +284,9 @@ async fn main() { .unwrap(), }; - import(config, filestr, download).await + import(&config, filestr, download).await } - Commands::Export { list } => export(config, list), + Commands::Export { list } => export(&config, list), Commands::Test => Ok(()), } .unwrap(); -- cgit v1.2.3