diff --git a/components/script/dom/bindings/xmlname.rs b/components/script/dom/bindings/xmlname.rs index aac839f53fd..a4774e2b0f7 100644 --- a/components/script/dom/bindings/xmlname.rs +++ b/components/script/dom/bindings/xmlname.rs @@ -110,15 +110,13 @@ pub fn xml_name_type(name: &str) -> XMLName { fn is_valid_continuation(c: char) -> bool { is_valid_start(c) || - match c { + matches!(c, '-' | '.' | '0'..='9' | '\u{B7}' | '\u{300}'..='\u{36F}' | - '\u{203F}'..='\u{2040}' => true, - _ => false, - } + '\u{203F}'..='\u{2040}') } let mut iter = name.chars(); diff --git a/components/script/dom/crypto.rs b/components/script/dom/crypto.rs index 844b165865d..e5c441815f0 100644 --- a/components/script/dom/crypto.rs +++ b/components/script/dom/crypto.rs @@ -64,14 +64,14 @@ impl CryptoMethods for Crypto { } fn is_integer_buffer(array_type: Type) -> bool { - match array_type { + matches!( + array_type, Type::Uint8 | - Type::Uint8Clamped | - Type::Int8 | - Type::Uint16 | - Type::Int16 | - Type::Uint32 | - Type::Int32 => true, - _ => false, - } + Type::Uint8Clamped | + Type::Int8 | + Type::Uint16 | + Type::Int16 | + Type::Uint32 | + Type::Int32 + ) } diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index c86cb2e0a9f..f4e9b16d2f1 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -345,16 +345,17 @@ impl Element { self.is.borrow().clone() } + /// pub fn set_custom_element_state(&self, state: CustomElementState) { // no need to inflate rare data for uncustomized if state != CustomElementState::Uncustomized || self.rare_data().is_some() { self.ensure_rare_data().custom_element_state = state; } - // https://dom.spec.whatwg.org/#concept-element-defined - let in_defined_state = match state { - CustomElementState::Uncustomized | CustomElementState::Custom => true, - _ => false, - }; + + let in_defined_state = matches!( + state, + CustomElementState::Uncustomized | CustomElementState::Custom + ); self.set_state(ElementState::DEFINED, in_defined_state) } @@ -1393,21 +1394,18 @@ impl Element { } // , ,