refactor: simple code quality changes
Signed-off-by: Christina Sørensen <christina@cafkafk.com>
This commit is contained in:
parent
89c5be194f
commit
b83ea9d538
2 changed files with 7 additions and 18 deletions
13
src/git.rs
13
src/git.rs
|
@ -315,7 +315,6 @@ impl GitRepo {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Config {
|
impl Config {
|
||||||
/* GIT RELATED */
|
|
||||||
/// Loads the configuration toml from a path in to the Config struct.
|
/// Loads the configuration toml from a path in to the Config struct.
|
||||||
pub fn new(path: &String) -> Self {
|
pub fn new(path: &String) -> Self {
|
||||||
debug!("initializing new Config struct");
|
debug!("initializing new Config struct");
|
||||||
|
@ -330,15 +329,9 @@ impl Config {
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
//////////////////////////////////////////////////////////////
|
|
||||||
//////////////////////////////////////////////////////////////
|
|
||||||
//////////////////////////////////////////////////////////////
|
|
||||||
/// Runs associated function on all repos in config
|
/// Runs associated function on all repos in config
|
||||||
///
|
///
|
||||||
/// TODO: need to be made over a generic repo type
|
|
||||||
///
|
|
||||||
/// NOTE: currently unused
|
/// NOTE: currently unused
|
||||||
///
|
|
||||||
fn on_all<F>(&self, f: F)
|
fn on_all<F>(&self, f: F)
|
||||||
where
|
where
|
||||||
F: Fn(&GitRepo),
|
F: Fn(&GitRepo),
|
||||||
|
@ -350,10 +343,6 @@ impl Config {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// Runs associated function on all repos in config
|
/// Runs associated function on all repos in config
|
||||||
///
|
|
||||||
/// TODO: need to be made over a generic repo type
|
|
||||||
///
|
|
||||||
///
|
|
||||||
fn on_all_spinner<F>(&self, op: &str, f: F)
|
fn on_all_spinner<F>(&self, op: &str, f: F)
|
||||||
where
|
where
|
||||||
F: Fn(&GitRepo) -> bool,
|
F: Fn(&GitRepo) -> bool,
|
||||||
|
@ -381,7 +370,7 @@ impl Config {
|
||||||
for category in self.categories.values() {
|
for category in self.categories.values() {
|
||||||
match category.links.as_ref() {
|
match category.links.as_ref() {
|
||||||
Some(links) => {
|
Some(links) => {
|
||||||
for (_, link) in links.iter() {
|
for link in links.values() {
|
||||||
if !settings::QUIET.load(std::sync::atomic::Ordering::Relaxed) {
|
if !settings::QUIET.load(std::sync::atomic::Ordering::Relaxed) {
|
||||||
let mut sp =
|
let mut sp =
|
||||||
Spinner::new(Spinners::Dots10, format!("{}: {}", link.name, op));
|
Spinner::new(Spinners::Dots10, format!("{}: {}", link.name, op));
|
||||||
|
|
|
@ -77,17 +77,17 @@ pub const SUCCESS_STRING: &str = "SUCC";
|
||||||
pub const FAILURE_STRING: &str = "FAIL";
|
pub const FAILURE_STRING: &str = "FAIL";
|
||||||
|
|
||||||
pub fn success_str() -> &'static str {
|
pub fn success_str() -> &'static str {
|
||||||
if !settings::EMOJIS.load(Ordering::Relaxed) {
|
if settings::EMOJIS.load(Ordering::Relaxed) {
|
||||||
SUCCESS_EMOJI
|
|
||||||
} else {
|
|
||||||
SUCCESS_STRING
|
SUCCESS_STRING
|
||||||
|
} else {
|
||||||
|
SUCCESS_EMOJI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn failure_str() -> &'static str {
|
pub fn failure_str() -> &'static str {
|
||||||
if !settings::EMOJIS.load(Ordering::Relaxed) {
|
if settings::EMOJIS.load(Ordering::Relaxed) {
|
||||||
FAILURE_EMOJI
|
|
||||||
} else {
|
|
||||||
FAILURE_STRING
|
FAILURE_STRING
|
||||||
|
} else {
|
||||||
|
FAILURE_EMOJI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue