diff options
author | komuhangi <51232461+jahielkomu@users.noreply.github.com> | 2024-04-07 10:39:05 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-07 07:39:05 +0000 |
commit | e0e34086501068af22f6df00ec9d0d2707a5494c (patch) | |
tree | a3e514ade58fe9e0089c5fe3d803b9c1047a660c /components/script/dom/htmlscriptelement.rs | |
parent | 05f1bbf0a92f2cd8495813cff03af227177de858 (diff) | |
download | servo-e0e34086501068af22f6df00ec9d0d2707a5494c.tar.gz servo-e0e34086501068af22f6df00ec9d0d2707a5494c.zip |
Fixed some clippy warnings by replacing 'match' with 'if' (#32007)
Diffstat (limited to 'components/script/dom/htmlscriptelement.rs')
-rw-r--r-- | components/script/dom/htmlscriptelement.rs | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/components/script/dom/htmlscriptelement.rs b/components/script/dom/htmlscriptelement.rs index 3bc1d35b9b7..d0a59070cb6 100644 --- a/components/script/dom/htmlscriptelement.rs +++ b/components/script/dom/htmlscriptelement.rs @@ -657,21 +657,20 @@ impl HTMLScriptElement { if script_type == ScriptType::Classic { let for_attribute = element.get_attribute(&ns!(), &local_name!("for")); let event_attribute = element.get_attribute(&ns!(), &local_name!("event")); - match (for_attribute, event_attribute) { - (Some(ref for_attribute), Some(ref event_attribute)) => { - let for_value = for_attribute.value().to_ascii_lowercase(); - let for_value = for_value.trim_matches(HTML_SPACE_CHARACTERS); - if for_value != "window" { - return; - } + if let (Some(ref for_attribute), Some(ref event_attribute)) = + (for_attribute, event_attribute) + { + let for_value = for_attribute.value().to_ascii_lowercase(); + let for_value = for_value.trim_matches(HTML_SPACE_CHARACTERS); + if for_value != "window" { + return; + } - let event_value = event_attribute.value().to_ascii_lowercase(); - let event_value = event_value.trim_matches(HTML_SPACE_CHARACTERS); - if event_value != "onload" && event_value != "onload()" { - return; - } - }, - (_, _) => (), + let event_value = event_attribute.value().to_ascii_lowercase(); + let event_value = event_value.trim_matches(HTML_SPACE_CHARACTERS); + if event_value != "onload" && event_value != "onload()" { + return; + } } } @@ -1239,15 +1238,12 @@ impl VirtualMethods for HTMLScriptElement { fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) { self.super_type().unwrap().attribute_mutated(attr, mutation); - match *attr.local_name() { - local_name!("src") => { - if let AttributeMutation::Set(_) = mutation { - if !self.parser_inserted.get() && self.upcast::<Node>().is_connected() { - self.prepare(); - } + if *attr.local_name() == local_name!("src") { + if let AttributeMutation::Set(_) = mutation { + if !self.parser_inserted.get() && self.upcast::<Node>().is_connected() { + self.prepare(); } - }, - _ => {}, + } } } |