From c7ecf3019a75dc0ab1a0aefeb9b880899fc8a231 Mon Sep 17 00:00:00 2001 From: fxqnlr Date: Mon, 29 May 2023 18:01:12 +0200 Subject: cargo fmt and add fmt file --- src/files.rs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src/files.rs') diff --git a/src/files.rs b/src/files.rs index c81857b..3a16c62 100644 --- a/src/files.rs +++ b/src/files.rs @@ -92,7 +92,9 @@ async fn download_version( let mut splitname: Vec<&str> = file.filename.split('.').collect(); let extension = match splitname.pop().ok_or("") { Ok(e) => e, - Err(..) => return Err(MLError::new(ErrorType::Other, "NO_FILE_EXTENSION")), + Err(..) => { + return Err(MLError::new(ErrorType::Other, "NO_FILE_EXTENSION")) + } }; let filename = format!( "{}.mr.{}.{}.{}", @@ -102,7 +104,8 @@ async fn download_version( extension ); - download_file(&file.url, &list.download_folder, &filename, &progress).await?; + download_file(&file.url, &list.download_folder, &filename, &progress) + .await?; progress.set_message(format!("Copy {} to cache", version.id)); let dl_path_file = format!("{}/{}", list.download_folder, filename); @@ -119,7 +122,12 @@ async fn download_version( Ok(()) } -async fn download_file(url: &str, path: &str, name: &str, progress: &ProgressBar) -> MLE<()> { +async fn download_file( + url: &str, + path: &str, + name: &str, + progress: &ProgressBar, +) -> MLE<()> { let dl_path_file = format!("{}/{}", path, name); let res = Client::new().get(url).send().await?; @@ -185,7 +193,9 @@ pub fn get_file_path(list: &List, versionid: String) -> MLE { if path.is_file() { let pathstr = match path.to_str().ok_or("") { Ok(s) => s, - Err(..) => return Err(MLError::new(ErrorType::Other, "INVALID_PATH")), + Err(..) => { + return Err(MLError::new(ErrorType::Other, "INVALID_PATH")) + } }; let namesplit: Vec<&str> = pathstr.split('.').collect(); let ver_id = namesplit[namesplit.len() - 2]; -- cgit v1.2.3