diff options
author | Jake Howard <[email protected]> | 2021-03-27 14:03:31 +0000 |
---|---|---|
committer | Jake Howard <[email protected]> | 2021-03-27 14:03:31 +0000 |
commit | a8138be69b0c051da9f97827a9f5427c98dd3051 (patch) | |
tree | 1d77b0776cbd67f06927ede248eb72f87ff11540 /src/api/icons.rs | |
parent | ea57dc3bc9253b8db8e0815bac344f2cf981894b (diff) | |
download | vaultwarden-a8138be69b0c051da9f97827a9f5427c98dd3051.tar.gz vaultwarden-a8138be69b0c051da9f97827a9f5427c98dd3051.zip |
Use `if let` more
Diffstat (limited to 'src/api/icons.rs')
-rw-r--r-- | src/api/icons.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/api/icons.rs b/src/api/icons.rs index 5abcf375..f2ef9f21 100644 --- a/src/api/icons.rs +++ b/src/api/icons.rs @@ -352,10 +352,12 @@ fn get_favicons_node(node: &std::rc::Rc<markup5ever_rcdom::Node>, icons: &mut Ve } } - if has_rel && href.is_some() { - if let Ok(full_href) = url.join(&href.unwrap()).map(|h| h.into_string()) { - let priority = get_icon_priority(&full_href, sizes); - icons.push(Icon::new(priority, full_href)); + if has_rel { + if let Some(inner_href) = href { + if let Ok(full_href) = url.join(&inner_href).map(|h| h.into_string()) { + let priority = get_icon_priority(&full_href, sizes); + icons.push(Icon::new(priority, full_href)); + } } } } @@ -472,7 +474,7 @@ fn get_icon_url(domain: &str) -> Result<IconUrlResult, Error> { let dom = html5ever::parse_document(markup5ever_rcdom::RcDom::default(), Default::default()) .from_utf8() .read_from(&mut limited_reader)?; - + get_favicons_node(&dom.document, &mut iconlist, &url); } else { // Add the default favicon.ico to the list with just the given domain |