From f5e070cdf6628a5ebd981d373929802317104e24 Mon Sep 17 00:00:00 2001 From: fxqnlr Date: Wed, 4 Sep 2024 09:56:42 +0200 Subject: clippy --fix --- src/config.rs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'src/config.rs') diff --git a/src/config.rs b/src/config.rs index f0eb8f7..3538a69 100644 --- a/src/config.rs +++ b/src/config.rs @@ -70,12 +70,9 @@ impl Cfg { }; //Check versions let versionfile = format!("{}/versions.json", config.versions); - match File::open(&versionfile) { - Ok(..) => (), - Err(..) => { - create_versions_dummy(&versionfile).await?; - check_game_versions(&versionfile, true).await?; - } + if let Ok(..) = File::open(&versionfile) { } else { + create_versions_dummy(&versionfile).await?; + check_game_versions(&versionfile, true).await?; } Ok(config) @@ -94,7 +91,7 @@ fn create_config(path: &str) -> MLE<()> { .to_string(); let default_cfg = Cfg { data: cache_dir.clone(), - cache: format!("{}/cache", cache_dir), + cache: format!("{cache_dir}/cache"), versions: cache_dir, defaults: Defaults { modloader: Modloader::Fabric, @@ -107,7 +104,7 @@ fn create_config(path: &str) -> MLE<()> { create_dir_all(path.split("config.toml").collect::>()[0])?; let mut file = File::create(path)?; file.write_all(toml::to_string(&default_cfg)?.as_bytes())?; - p.finish_with_message(format!("Created default config ({})", path)); + p.finish_with_message(format!("Created default config ({path})")); Ok(()) } @@ -118,7 +115,7 @@ fn create_database(path: &str) -> MLE<()> { File::create(path)?; db_setup(path)?; - p.finish_with_message(format!("Created database ({})", path)); + p.finish_with_message(format!("Created database ({path})")); Ok(()) } @@ -128,7 +125,7 @@ fn create_cache(path: &str) -> MLE<()> { p.set_message("Create cache"); create_dir_all(path)?; - p.finish_with_message(format!("Created cache ({})", path)); + p.finish_with_message(format!("Created cache ({path})")); Ok(()) } @@ -137,6 +134,6 @@ async fn create_versions_dummy(path: &str) -> MLE<()> { p.set_style(ProgressStyle::with_template("{wide_msg}").unwrap()); p.set_message("Create version file"); File::create(path)?; - p.finish_with_message(format!("Created version file ({})", path)); + p.finish_with_message(format!("Created version file ({path})")); Ok(()) } -- cgit v1.2.3