summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2021-08-04 18:08:51 +0200
committerSanto Cariotti <santo@dcariotti.me>2021-08-04 18:08:51 +0200
commit7c445e6458b6b209ce59ed89dbb73daa96e2199f (patch)
treed5901fba902c4db49e07886816e4f8a15a64621c
parent909e2cbdf8cbb311f4abef2c0c1d176987580a76 (diff)
chore: create an empty hashmap for faculties in case of error is useless
-rw-r--r--src/browser/mod.rs13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/browser/mod.rs b/src/browser/mod.rs
index 2765c6d..d5ec337 100644
--- a/src/browser/mod.rs
+++ b/src/browser/mod.rs
@@ -22,15 +22,10 @@ pub async unsafe fn login(credentials: &Config) -> WebDriverResult<()> {
pub async unsafe fn get_faculties() -> WebDriverResult<Option<HashMap<String, String>>> {
if let Some(driver) = &WEB_BROWSER {
- match driver.faculties().await? {
- Some(faculties) => {
- return Ok(Some(faculties));
- }
- None => {
- return Ok(Some(HashMap::<String, String>::new()));
- }
- };
+ if let Some(faculties) = driver.faculties().await? {
+ return Ok(Some(faculties));
+ }
}
- Ok(Some(HashMap::<String, String>::new()))
+ Ok(None)
}