From e753a7bf5279090914b43ed7969e86c42dd3e902 Mon Sep 17 00:00:00 2001 From: "Wyatt J. Miller" Date: Wed, 28 Jul 2021 21:30:24 -0400 Subject: [PATCH] formatting stuff --- src/main.rs | 6 +++--- src/request.rs | 30 ++++++++++++++++-------------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/main.rs b/src/main.rs index 9823d49..6f6bd6c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,6 @@ // gt - a gitea cli client // Written by Wyatt J. Miller -// All right reserved, 2020 +// All right reserved, 2020 - 2021 // Licensed by the MPL v2 mod arg; @@ -12,8 +12,8 @@ mod request; use clap::ArgMatches; fn main() { - let mut matches: ArgMatches = arg::get_args(); - let mut config = crate::config::Configuration::new(); + let matches: ArgMatches = arg::get_args(); + let config = crate::config::Configuration::new(); let auth = request::Authentication::new(&config); let request = auth.request_chooser(config.clone(), matches); diff --git a/src/request.rs b/src/request.rs index 2eb89cd..e53c0a9 100644 --- a/src/request.rs +++ b/src/request.rs @@ -57,28 +57,30 @@ impl Authentication{ /// secure methods. Currently, only two methods are supported: API token, and /// username/password combo. pub fn new(config: &Configuration) -> Authentication { - let basic_auth: String; - let api_auth: String; - // TODO: might be broken, haven't tested // this is horror code, I know it // match the damn thing // someone is going to take this and put it in r/badcode lol - basic_auth = config - .password - .as_ref() - .unwrap() - .to_string(); + let basic_auth = config + .password + .as_ref() + .unwrap() + .to_string(); - api_auth = config - .api_token - .as_ref() - .unwrap() - .to_string(); + let api_auth = config + .api_token + .as_ref() + .unwrap() + .to_string(); if api_auth.is_empty() { if !(basic_auth.is_empty()) { - Authentication::with_basic(config.username.as_ref().unwrap().to_string(), basic_auth) + Authentication::with_basic(config + .username + .as_ref() + .unwrap() + .to_string(), + basic_auth) } else { panic!("Must have some form of authentication! Exiting..."); }