clippy: Fix option_map_or_none warnings (#31983)

This commit is contained in:
Oluwatobi Sofela 2024-04-03 12:39:52 +01:00 committed by GitHub
parent 66878fb834
commit b228d7869d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View file

@ -3955,7 +3955,7 @@ pub(crate) fn referrer_policy_for_element(element: &Element) -> Option<ReferrerP
}
pub(crate) fn cors_setting_for_element(element: &Element) -> Option<CorsSettings> {
reflect_cross_origin_attribute(element).map_or(None, |attr| match &*attr {
reflect_cross_origin_attribute(element).and_then(|attr| match &*attr {
"anonymous" => Some(CorsSettings::Anonymous),
"use-credentials" => Some(CorsSettings::UseCredentials),
_ => unreachable!(),

View file

@ -310,7 +310,7 @@ impl HTMLSelectElementMethods for HTMLSelectElement {
fn NamedItem(&self, name: DOMString) -> Option<DomRoot<HTMLOptionElement>> {
self.Options()
.NamedGetter(name)
.map_or(None, DomRoot::downcast::<HTMLOptionElement>)
.and_then(DomRoot::downcast::<HTMLOptionElement>)
}
// https://html.spec.whatwg.org/multipage/#dom-select-remove