From 8b4c70e6c8c98f5620ef43e238ee4d17d5e257df Mon Sep 17 00:00:00 2001
From: Valentin Tolmer <valentin@tolmer.fr>
Date: Wed, 8 Dec 2021 11:07:55 +0100
Subject: [PATCH] app: fix clippy warning

---
 app/src/infra/cookies.rs | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/app/src/infra/cookies.rs b/app/src/infra/cookies.rs
index b3840bf..2605c8c 100644
--- a/app/src/infra/cookies.rs
+++ b/app/src/infra/cookies.rs
@@ -5,8 +5,7 @@ use web_sys::HtmlDocument;
 
 fn get_document() -> Result<HtmlDocument> {
     web_sys::window()
-        .map(|w| w.document())
-        .flatten()
+        .and_then(|w| w.document())
         .ok_or_else(|| anyhow!("Could not get window document"))
         .and_then(|d| {
             d.dyn_into::<web_sys::HtmlDocument>()
@@ -16,8 +15,7 @@ fn get_document() -> Result<HtmlDocument> {
 
 pub fn set_cookie(cookie_name: &str, value: &str, expiration: &DateTime<Utc>) -> Result<()> {
     let doc = web_sys::window()
-        .map(|w| w.document())
-        .flatten()
+        .and_then(|w| w.document())
         .ok_or_else(|| anyhow!("Could not get window document"))
         .and_then(|d| {
             d.dyn_into::<web_sys::HtmlDocument>()