From 34bc38d293467ca766c985a2e4272f58b92ab82a Mon Sep 17 00:00:00 2001 From: kdeng00 Date: Thu, 30 Oct 2025 14:31:43 -0400 Subject: [PATCH] More cleanup --- src/managers/commit_manager.rs | 20 ++++++++------------ src/managers/token_manager.rs | 17 +++++------------ 2 files changed, 13 insertions(+), 24 deletions(-) diff --git a/src/managers/commit_manager.rs b/src/managers/commit_manager.rs index 629e3f4..7973e40 100644 --- a/src/managers/commit_manager.rs +++ b/src/managers/commit_manager.rs @@ -195,7 +195,7 @@ impl CommitManager { Err(err) => { eprintln!("Error generating song filename: {err:?}"); utilities::checks::exit_program(-3); - return + return; } }; match song.save_to_filesystem() { @@ -436,17 +436,11 @@ impl CommitManager { println!("Queued status updated"); Ok(()) } - Err(err) => { - Err(std::io::Error::other(err.to_string())) - } + Err(err) => Err(std::io::Error::other(err.to_string())), }, - Err(err) => { - Err(std::io::Error::other(err.to_string())) - } + Err(err) => Err(std::io::Error::other(err.to_string())), }, - Err(err) => { - Err(std::io::Error::other(err.to_string())) - } + Err(err) => Err(std::io::Error::other(err.to_string())), } } @@ -490,7 +484,7 @@ impl CommitManager { } Ok(songs) } - Err(_) => Err(std::io::Error::other("Songs not retrieved")) + Err(_) => Err(std::io::Error::other("Songs not retrieved")), } } @@ -571,7 +565,9 @@ impl CommitManager { } } - Err(std::io::Error::other("CoverArt directory and filename not found")) + Err(std::io::Error::other( + "CoverArt directory and filename not found", + )) } fn find_file_extension(&self, file_name: &std::ffi::OsString) -> En { diff --git a/src/managers/token_manager.rs b/src/managers/token_manager.rs index a539f0e..e6a53c3 100644 --- a/src/managers/token_manager.rs +++ b/src/managers/token_manager.rs @@ -23,7 +23,6 @@ impl Default for TokenManager { user: icarus_models::user::User::default(), api: models::api::Api::default(), }; - token.init(); token @@ -35,7 +34,6 @@ impl TokenManager { println!("Sending request for a token"); let url = self.retrieve_url(); - println!("URL: {url}"); let mut token = icarus_models::token::AccessToken { @@ -62,19 +60,18 @@ impl TokenManager { token.token_type = login_result.token_type.clone(); token.expiration = login_result.expiration; token.message = response.message; + Ok(token) } - Err(_) => println!("Hm, the response didn't match the shape we expected."), - }; + Err(err) => Err(std::io::Error::other(err.to_string())), + } } reqwest::StatusCode::UNAUTHORIZED => { - println!("Need to grab a new token"); + Err(std::io::Error::other("Need to grab a new token")) } other => { panic!("Uh oh! Something unexpected happened: {other:?}"); } } - - Ok(token) } pub fn init(&mut self) { @@ -84,10 +81,6 @@ impl TokenManager { } pub fn retrieve_url(&self) -> String { - let api = &self.api; - let mut url = String::from(&api.url); - url += &String::from(&api.endpoint); - - url + format!("{}{}", self.api.url, self.api.endpoint) } }