clippy: Fix match_like_matches warnings (#31947)

* clippy: Fix `match_like_matches` warnings

* Fix link to custom element state in specification.

---------

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
eri 2024-03-30 11:06:26 +01:00 committed by GitHub
parent 92d9081366
commit e3d6b66d5f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 34 additions and 54 deletions

View file

@ -149,10 +149,7 @@ impl<'dom, LayoutDataType: LayoutDataTrait> ServoLayoutElement<'dom, LayoutDataT
fn is_root(&self) -> bool {
match self.as_node().parent_node() {
None => false,
Some(node) => match node.script_type_id() {
NodeTypeId::Document(_) => true,
_ => false,
},
Some(node) => matches!(node.script_type_id(), NodeTypeId::Document(_)),
}
}
}
@ -587,15 +584,11 @@ impl<'dom, LayoutDataType: LayoutDataTrait> ::selectors::Element
NonTSPseudoClass::Lang(ref lang) => self.match_element_lang(None, lang),
NonTSPseudoClass::ServoNonZeroBorder => {
match self
.element
.get_attr_for_layout(&ns!(), &local_name!("border"))
{
None | Some(&AttrValue::UInt(_, 0)) => false,
_ => true,
}
},
NonTSPseudoClass::ServoNonZeroBorder => !matches!(
self.element
.get_attr_for_layout(&ns!(), &local_name!("border")),
None | Some(&AttrValue::UInt(_, 0))
),
NonTSPseudoClass::ReadOnly => !self
.element
.get_state_for_layout()