diff --git a/src/api/main_api.rs b/src/api/main_api.rs index af51d7f98..6cfbec73a 100644 --- a/src/api/main_api.rs +++ b/src/api/main_api.rs @@ -26,7 +26,7 @@ async fn index( _req: HttpRequest, _app_state: web::Data, ) -> std::io::Result { - let path: PathBuf = [_app_state.config.api.web_root.clone(), String::from("index.html")].iter().collect(); + let path: PathBuf = [&_app_state.config.api.web_root, "index.html"].iter().collect(); NamedFile::open(path) } diff --git a/src/api/xtream_player_api.rs b/src/api/xtream_player_api.rs index 259162616..dfd8fd5d0 100644 --- a/src/api/xtream_player_api.rs +++ b/src/api/xtream_player_api.rs @@ -9,7 +9,7 @@ use crate::model::model_config::{default_as_empty_str}; use crate::repository::xtream_repository::{COL_CAT_LIVE, COL_CAT_SERIES, COL_CAT_VOD, COL_LIVE, COL_SERIES, COL_VOD, xtream_get_all}; fn get_user_info(user_name: &str, cfg: &Config) -> XtreamAuthorizationResponse { - let server = cfg._api_proxy.as_ref().unwrap().server.clone(); + let server = &cfg._api_proxy.as_ref().unwrap().server; let now = Local::now(); XtreamAuthorizationResponse { user_info: XtreamUserInfo { diff --git a/src/processing/playlist_watch.rs b/src/processing/playlist_watch.rs index 730b68d69..fbb526a7d 100644 --- a/src/processing/playlist_watch.rs +++ b/src/processing/playlist_watch.rs @@ -32,14 +32,14 @@ pub(crate) fn process_group_watch(cfg: &Config, target_name: &str, pl: &Playlist } } None => { - error!("failed to load watch_file {}", &path.into_os_string().into_string().unwrap()); + error!("failed to load watch_file {}", &path.to_str().unwrap()); } } } match save_tree(&save_path, new_tree) { Ok(_) => {} Err(err) => { - error!("failed to write watch_file {}: {}", &save_path.into_os_string().into_string().unwrap(), err) + error!("failed to write watch_file {}: {}", &save_path.to_str().unwrap(), err) } } } diff --git a/src/repository/m3u_repository.rs b/src/repository/m3u_repository.rs index 9890707f8..59409e074 100644 --- a/src/repository/m3u_repository.rs +++ b/src/repository/m3u_repository.rs @@ -83,7 +83,7 @@ fn kodi_style_rename(name: &String, style: &KodiStyle) -> String { fn write_m3u_playlist(target: &ConfigTarget, cfg: &Config, new_playlist: &mut Vec) -> Result<(), M3uFilterError> { macro_rules! cant_write_result { ($path:expr, $err:expr) => { - create_m3u_filter_error_result!(M3uFilterErrorKind::Notify, "failed to write m3u playlist: {} - {}", $path.clone().into_os_string().into_string().unwrap() ,$err) + create_m3u_filter_error_result!(M3uFilterErrorKind::Notify, "failed to write m3u playlist: {} - {}", $path.to_str().unwrap() ,$err) } } if !new_playlist.is_empty() { diff --git a/src/repository/xtream_repository.rs b/src/repository/xtream_repository.rs index 9fbfa2a3d..0a4263771 100644 --- a/src/repository/xtream_repository.rs +++ b/src/repository/xtream_repository.rs @@ -85,7 +85,7 @@ fn get_collection_path(path: &Path, collection: &str) -> PathBuf { pub(crate) fn xtream_save_playlist(target: &ConfigTarget, cfg: &Config, playlist: &mut [PlaylistGroup]) -> Result<(), M3uFilterError> { if let Some(path) = get_storage_path(cfg, &target.name) { if fs::create_dir_all(&path).is_err() { - let msg = format!("Failed to save, can't create directory {}", &path.into_os_string().into_string().unwrap()); + let msg = format!("Failed to save, can't create directory {}", &path.to_str().unwrap()); return Err(M3uFilterError::new(M3uFilterErrorKind::Notify, msg)); } @@ -180,7 +180,7 @@ pub(crate) fn xtream_save_playlist(target: &ConfigTarget, cfg: &Config, playlist match write_to_file(&col_path, data) { Ok(()) => {} Err(err) => { - errors.push(format!("Persisting collection failed: {}: {}", &col_path.clone().into_os_string().into_string().unwrap(), err)); + errors.push(format!("Persisting collection failed: {}: {}", &col_path.to_str().unwrap(), err)); } } } diff --git a/src/utils.rs b/src/utils.rs index a6d016b80..6cf1cf342 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -121,7 +121,7 @@ pub(crate) fn get_input_content(working_dir: &String, url_str: &str, persist_fil match open_file(file) { Ok(content) => Some(std::io::BufReader::new(content).lines().map(|l| l.unwrap()).collect()), Err(err) => { - let file_str = &file.clone().into_os_string().into_string().unwrap(); + let file_str = file.to_str().unwrap(); error!("cant read: {} {}", file_str, err); return create_m3u_filter_error_result!(M3uFilterErrorKind::Notify, "Cant open file : {} => {}", file_str, err); }