@@ -34,22 +34,16 @@ pub(crate) fn get_config_file_path() -> Result<PathBuf, String> {
3434 if config_file. exists ( ) {
3535 // Load the config for validation
3636 let config = crate :: config:: load_config ( & config_file)
37- . map_err ( |e| format ! ( "Failed to load config for validation: {}" , e ) ) ?;
37+ . map_err ( |e| format ! ( "Failed to load config for validation: {e}" ) ) ?;
3838
3939 // Validate the JSON structure
4040 if validate_json ( & config) {
41- println ! (
42- "✅ Config file loaded successfully from path: {:?}" ,
43- config_file
44- ) ;
41+ println ! ( "✅ Config file loaded successfully from path: {config_file:?}" ) ;
4542 }
4643 } else {
47- println ! (
48- "⚠️ Config file not found. Creating new default config at: {:?}" ,
49- config_file
50- ) ;
44+ println ! ( "⚠️ Config file not found. Creating new default config at: {config_file:?}" ) ;
5145 create_default_config ( & config_file)
52- . map_err ( |e| format ! ( "Failed to create default config file: {}" , e ) ) ?;
46+ . map_err ( |e| format ! ( "Failed to create default config file: {e}" ) ) ?;
5347 }
5448
5549 Ok ( config_file)
@@ -66,7 +60,7 @@ pub fn load_config(path: &PathBuf) -> anyhow::Result<Config> {
6660// Save the entire configuration (including commands and other sections) to a file.
6761pub fn save_config ( path : & Path , config : & Config ) {
6862 let config_data = serde_json:: to_string_pretty ( config) . expect ( "❌ Failed to serialize config" ) ;
69- let mut file = File :: create ( path) . expect ( "❌ Unable to create config file" ) ;
63+ let mut file = File :: create ( path) . expect ( "❌ Unable to create config file " ) ;
7064 // Write the serialized config data to the file
7165 file. write_all ( config_data. as_bytes ( ) )
7266 . expect ( "❌ Unable to write to config file" ) ;
@@ -92,7 +86,7 @@ pub fn edit_cmd_sound(config: &mut Config, changes_made: &mut bool) {
9286 . as_ref ( )
9387 . map_or ( String :: new ( ) , |path| path. display ( ) . to_string ( ) ) ;
9488
95- println ! ( "Current sound file: {}" , current_sound ) ;
89+ println ! ( "Current sound file: {current_sound}" ) ;
9690
9791 let sound_path = Text :: new ( "Enter the new path for cmd_sound (leave empty to clear):" )
9892 . with_initial_value ( & current_sound)
@@ -134,7 +128,7 @@ pub fn edit_window_title(config: &mut Config, changes_made: &mut bool) {
134128 . as_ref ( )
135129 . map_or ( String :: new ( ) , |title| title. clone ( ) ) ;
136130
137- println ! ( "Current window title: {}" , current_title ) ;
131+ println ! ( "Current window title: {current_title}" ) ;
138132
139133 let new_title = Text :: new ( "Enter the new window title (leave empty to clear):" )
140134 . with_initial_value ( & current_title)
@@ -147,7 +141,7 @@ pub fn edit_window_title(config: &mut Config, changes_made: &mut bool) {
147141 } else {
148142 let new_title = new_title. trim ( ) ;
149143 config. window_title = Some ( new_title. to_string ( ) ) ;
150- println ! ( "✅ Window title updated to: {}" , new_title ) ;
144+ println ! ( "✅ Window title updated to: {new_title}" ) ;
151145 }
152146
153147 * changes_made = true ;
0 commit comments