@@ -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,26 @@ 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+ if cfg ! ( target_os = "windows" ) {
304303 std:: env:: var ( "LOCALAPPDATA" ) . unwrap ( )
305304 } else {
306305 std:: env:: var ( "HOME" ) . unwrap ( )
307- } ;
308-
309- return path;
306+ }
310307}
311308
312309pub fn get_config_file_path ( ) -> String {
313310 let home = get_config_installation_dir ( ) ;
314- let file_path = if cfg ! ( target_os = "windows" ) {
311+
312+ if cfg ! ( target_os = "windows" ) {
315313 home + "\\ rustcast\\ config.toml"
316314 } else {
317315 home + "/.config/rustcast/config.toml"
318- } ;
319-
320- return file_path;
316+ }
321317}
322318use crate :: config:: Config ;
323319
324320pub fn read_config_file ( file_path : & str ) -> Result < Config , std:: io:: Error > {
325- let config: Config = match std:: fs:: read_to_string ( & file_path) {
321+ let config: Config = match std:: fs:: read_to_string ( file_path) {
326322 Ok ( a) => toml:: from_str ( & a) . unwrap ( ) ,
327323 Err ( _) => Config :: default ( ) ,
328324 } ;
@@ -335,10 +331,10 @@ pub fn create_config_file_if_not_exists(
335331 config : & Config ,
336332) -> Result < ( ) , std:: io:: Error > {
337333 // check if file exists
338- if let Ok ( exists) = std:: fs:: metadata ( & file_path) {
339- if exists. is_file ( ) {
340- return Ok ( ( ) ) ;
341- }
334+ if let Ok ( exists) = std:: fs:: metadata ( file_path)
335+ && exists. is_file ( )
336+ {
337+ return Ok ( ( ) ) ;
342338 }
343339
344340 let path = Path :: new ( & file_path) ;
@@ -347,15 +343,15 @@ pub fn create_config_file_if_not_exists(
347343 }
348344
349345 std:: fs:: write (
350- & file_path,
346+ file_path,
351347 toml:: to_string ( & config) . unwrap_or_else ( |x| x. to_string ( ) ) ,
352348 )
353349 . unwrap ( ) ;
354350
355351 Ok ( ( ) )
356352}
357353
358- pub fn open_application ( path : & String ) {
354+ pub fn open_application ( path : & str ) {
359355 #[ cfg( target_os = "windows" ) ]
360356 {
361357 use std:: process:: Command ;
0 commit comments