@@ -5,9 +5,8 @@ use std::{
55 process:: exit,
66} ;
77
8- use crate :: app:: { DEFAULT_WINDOW_HEIGHT , WINDOW_WIDTH } ;
98use global_hotkey:: hotkey:: Code ;
10- use iced:: { futures :: io :: Window , widget:: image:: Handle } ;
9+ use iced:: widget:: image:: Handle ;
1110use icns:: IconFamily ;
1211use image:: RgbaImage ;
1312use rayon:: iter:: { IntoParallelIterator , ParallelIterator } ;
@@ -300,29 +299,29 @@ pub fn to_key_code(key_str: &str) -> Option<Code> {
300299}
301300
302301pub fn get_config_installation_dir ( ) -> String {
303- let path = if cfg ! ( target_os = "windows" ) {
302+
303+
304+ if cfg ! ( target_os = "windows" ) {
304305 std:: env:: var ( "LOCALAPPDATA" ) . unwrap ( )
305306 } else {
306307 std:: env:: var ( "HOME" ) . unwrap ( )
307- } ;
308-
309- return path;
308+ }
310309}
311310
312311pub fn get_config_file_path ( ) -> String {
313312 let home = get_config_installation_dir ( ) ;
314- let file_path = if cfg ! ( target_os = "windows" ) {
313+
314+
315+ if cfg ! ( target_os = "windows" ) {
315316 home + "\\ rustcast\\ config.toml"
316317 } else {
317318 home + "/.config/rustcast/config.toml"
318- } ;
319-
320- return file_path;
319+ }
321320}
322321use crate :: config:: Config ;
323322
324323pub fn read_config_file ( file_path : & str ) -> Result < Config , std:: io:: Error > {
325- let config: Config = match std:: fs:: read_to_string ( & file_path) {
324+ let config: Config = match std:: fs:: read_to_string ( file_path) {
326325 Ok ( a) => toml:: from_str ( & a) . unwrap ( ) ,
327326 Err ( _) => Config :: default ( ) ,
328327 } ;
@@ -335,27 +334,26 @@ pub fn create_config_file_if_not_exists(
335334 config : & Config ,
336335) -> Result < ( ) , std:: io:: Error > {
337336 // check if file exists
338- if let Ok ( exists) = std:: fs:: metadata ( & file_path) {
339- if exists. is_file ( ) {
337+ if let Ok ( exists) = std:: fs:: metadata ( file_path)
338+ && exists. is_file ( ) {
340339 return Ok ( ( ) ) ;
341340 }
342- }
343341
344342 let path = Path :: new ( & file_path) ;
345343 if let Some ( parent) = path. parent ( ) {
346344 std:: fs:: create_dir_all ( parent) . unwrap ( ) ;
347345 }
348346
349347 std:: fs:: write (
350- & file_path,
348+ file_path,
351349 toml:: to_string ( & config) . unwrap_or_else ( |x| x. to_string ( ) ) ,
352350 )
353351 . unwrap ( ) ;
354352
355353 Ok ( ( ) )
356354}
357355
358- pub fn open_application ( path : & String ) {
356+ pub fn open_application ( path : & str ) {
359357 #[ cfg( target_os = "windows" ) ]
360358 {
361359 use std:: process:: Command ;
0 commit comments