app: fix clippy warning

This commit is contained in:
Valentin Tolmer 2021-12-08 11:07:55 +01:00 committed by nitnelave
parent 6c9086cc78
commit 204232659d

View File

@ -5,8 +5,7 @@ use web_sys::HtmlDocument;
fn get_document() -> Result<HtmlDocument> { fn get_document() -> Result<HtmlDocument> {
web_sys::window() web_sys::window()
.map(|w| w.document()) .and_then(|w| w.document())
.flatten()
.ok_or_else(|| anyhow!("Could not get window document")) .ok_or_else(|| anyhow!("Could not get window document"))
.and_then(|d| { .and_then(|d| {
d.dyn_into::<web_sys::HtmlDocument>() 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<()> { pub fn set_cookie(cookie_name: &str, value: &str, expiration: &DateTime<Utc>) -> Result<()> {
let doc = web_sys::window() let doc = web_sys::window()
.map(|w| w.document()) .and_then(|w| w.document())
.flatten()
.ok_or_else(|| anyhow!("Could not get window document")) .ok_or_else(|| anyhow!("Could not get window document"))
.and_then(|d| { .and_then(|d| {
d.dyn_into::<web_sys::HtmlDocument>() d.dyn_into::<web_sys::HtmlDocument>()