From 7c445e6458b6b209ce59ed89dbb73daa96e2199f Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Wed, 4 Aug 2021 18:08:51 +0200 Subject: chore: create an empty hashmap for faculties in case of error is useless --- src/browser/mod.rs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'src') 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>> { if let Some(driver) = &WEB_BROWSER { - match driver.faculties().await? { - Some(faculties) => { - return Ok(Some(faculties)); - } - None => { - return Ok(Some(HashMap::::new())); - } - }; + if let Some(faculties) = driver.faculties().await? { + return Ok(Some(faculties)); + } } - Ok(Some(HashMap::::new())) + Ok(None) } -- cgit v1.2.3-18-g5258