From 0136edf9892784eabf107c140205f4ea3ae82dd2 Mon Sep 17 00:00:00 2001 From: rink1969 Date: Tue, 26 Mar 2024 16:32:03 +0800 Subject: [PATCH] fix clippy warn --- src/config.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/config.rs b/src/config.rs index 327f00a..797eabc 100644 --- a/src/config.rs +++ b/src/config.rs @@ -14,8 +14,6 @@ use std::collections::BTreeMap; use std::fs; -use std::fs::File; -use std::io::Write; use std::path::Path; use std::path::PathBuf; use std::str::FromStr; @@ -62,9 +60,11 @@ impl Config { } fn use_default_config(config_file: PathBuf) -> Result { - let mut f = File::options().write(true).create(true).open(config_file)?; let default_config = Self::default(); - f.write_all(toml::to_string_pretty(&default_config).unwrap().as_bytes())?; + fs::write( + config_file, + toml::to_string_pretty(&default_config).unwrap().as_bytes(), + )?; Ok(default_config) }