From 7e6b9312b5fd0ab8597cd14f0143fb01082921ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christina=20S=C3=B8rensen?= Date: Wed, 5 Jul 2023 13:27:01 +0200 Subject: [PATCH] refactor: simple code quality changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christina Sørensen --- src/git.rs | 13 +------------ src/utils/strings.rs | 12 ++++++------ 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/src/git.rs b/src/git.rs index ec9aed8..a637b73 100644 --- a/src/git.rs +++ b/src/git.rs @@ -315,7 +315,6 @@ impl GitRepo { } impl Config { - /* GIT RELATED */ /// Loads the configuration toml from a path in to the Config struct. pub fn new(path: &String) -> Self { debug!("initializing new Config struct"); @@ -330,15 +329,9 @@ impl Config { ) }) } - ////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////// /// Runs associated function on all repos in config /// - /// TODO: need to be made over a generic repo type - /// /// NOTE: currently unused - /// fn on_all(&self, f: F) where F: Fn(&GitRepo), @@ -350,10 +343,6 @@ impl Config { } } /// Runs associated function on all repos in config - /// - /// TODO: need to be made over a generic repo type - /// - /// fn on_all_spinner(&self, op: &str, f: F) where F: Fn(&GitRepo) -> bool, @@ -381,7 +370,7 @@ impl Config { for category in self.categories.values() { match category.links.as_ref() { Some(links) => { - for (_, link) in links.iter() { + for link in links.values() { if !settings::QUIET.load(std::sync::atomic::Ordering::Relaxed) { let mut sp = Spinner::new(Spinners::Dots10, format!("{}: {}", link.name, op)); diff --git a/src/utils/strings.rs b/src/utils/strings.rs index b11eebc..55b28bf 100644 --- a/src/utils/strings.rs +++ b/src/utils/strings.rs @@ -77,17 +77,17 @@ pub const SUCCESS_STRING: &str = "SUCC"; pub const FAILURE_STRING: &str = "FAIL"; pub fn success_str() -> &'static str { - if !settings::EMOJIS.load(Ordering::Relaxed) { - SUCCESS_EMOJI - } else { + if settings::EMOJIS.load(Ordering::Relaxed) { SUCCESS_STRING + } else { + SUCCESS_EMOJI } } pub fn failure_str() -> &'static str { - if !settings::EMOJIS.load(Ordering::Relaxed) { - FAILURE_EMOJI - } else { + if settings::EMOJIS.load(Ordering::Relaxed) { FAILURE_STRING + } else { + FAILURE_EMOJI } }