Change match to if

This commit is contained in:
Sergey Isaev 2020-08-07 12:28:46 +03:00
parent 707168de0a
commit 3b81e6a219

View File

@ -41,11 +41,8 @@ impl CLI for LoginCommand {
} }
}; };
match Path::new(LEO_CREDENTIALS_DIR).exists() { if !Path::new(LEO_CREDENTIALS_DIR).exists() {
true => {} create_dir(LEO_CREDENTIALS_DIR)?;
false => {
create_dir(LEO_CREDENTIALS_DIR)?;
}
} }
let mut credentials = File::create(&format!("{}/{}", LEO_CREDENTIALS_DIR, LEO_CREDENTIALS_FILE))?; let mut credentials = File::create(&format!("{}/{}", LEO_CREDENTIALS_DIR, LEO_CREDENTIALS_FILE))?;
@ -56,7 +53,6 @@ impl CLI for LoginCommand {
} }
} }
// Run tests in single thread
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
@ -117,6 +113,7 @@ mod tests {
let token = "SOME_TOKEN".to_string(); let token = "SOME_TOKEN".to_string();
let options = Some(token.clone()); let options = Some(token.clone());
LoginCommand::output(options).unwrap(); LoginCommand::output(options).unwrap();
assert_eq!(token, get_token(suffix)?); assert_eq!(token, get_token(suffix)?);
clean(suffix)?; clean(suffix)?;
Ok(()) Ok(())