aboutsummaryrefslogtreecommitdiffstats
path: root/components/script
diff options
context:
space:
mode:
authorRosemary Ajayi <okhuomonajayi54@gmail.com>2024-03-28 12:28:33 +0100
committerGitHub <noreply@github.com>2024-03-28 11:28:33 +0000
commitaf358f51dbfb80ec8b7bbae4c2da983049420500 (patch)
tree83eef868545fdbfaa8ae075c85b0fffe8f624f6d /components/script
parent3ddb47e902901514285c89f9a3b53581ca750933 (diff)
downloadservo-af358f51dbfb80ec8b7bbae4c2da983049420500.tar.gz
servo-af358f51dbfb80ec8b7bbae4c2da983049420500.zip
clippy: Fix another batch of clippy warnings in `components/scripts` (#31912)
* boolean can be simplified * boolean can be simplified * boolean can be simplified
Diffstat (limited to 'components/script')
-rw-r--r--components/script/dom/mediasession.rs2
-rw-r--r--components/script/dom/node.rs18
2 files changed, 10 insertions, 10 deletions
diff --git a/components/script/dom/mediasession.rs b/components/script/dom/mediasession.rs
index 40d4053c5fd..fde228f48d5 100644
--- a/components/script/dom/mediasession.rs
+++ b/components/script/dom/mediasession.rs
@@ -141,7 +141,7 @@ impl MediaSessionMethods for MediaSession {
/// <https://w3c.github.io/mediasession/#dom-mediasession-metadata>
fn SetMetadata(&self, metadata: Option<&MediaMetadata>) {
- if let Some(ref metadata) = metadata {
+ if let Some(metadata) = metadata {
metadata.set_session(self);
}
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs
index cab2a68346d..85305103c40 100644
--- a/components/script/dom/node.rs
+++ b/components/script/dom/node.rs
@@ -1562,12 +1562,12 @@ impl<'dom> LayoutNodeHelpers<'dom> for LayoutDom<'dom, Node> {
fn iframe_browsing_context_id(self) -> Option<BrowsingContextId> {
self.downcast::<HTMLIFrameElement>()
- .map_or(None, |iframe_element| iframe_element.browsing_context_id())
+ .and_then(|iframe_element| iframe_element.browsing_context_id())
}
fn iframe_pipeline_id(self) -> Option<PipelineId> {
self.downcast::<HTMLIFrameElement>()
- .map_or(None, |iframe_element| iframe_element.pipeline_id())
+ .and_then(|iframe_element| iframe_element.pipeline_id())
}
#[allow(unsafe_code)]
@@ -1918,7 +1918,7 @@ impl Node {
0 => (),
// Step 6.1.2
1 => {
- if !parent.child_elements().next().is_none() {
+ if parent.child_elements().next().is_some() {
return Err(Error::HierarchyRequest);
}
if let Some(child) = child {
@@ -1936,10 +1936,10 @@ impl Node {
},
// Step 6.2
NodeTypeId::Element(_) => {
- if !parent.child_elements().next().is_none() {
+ if parent.child_elements().next().is_some() {
return Err(Error::HierarchyRequest);
}
- if let Some(ref child) = child {
+ if let Some(child) = child {
if child
.inclusively_following_siblings()
.any(|child| child.is_doctype())
@@ -1964,7 +1964,7 @@ impl Node {
}
},
None => {
- if !parent.child_elements().next().is_none() {
+ if parent.child_elements().next().is_some() {
return Err(Error::HierarchyRequest);
}
},
@@ -2952,7 +2952,7 @@ impl NodeMethods for Node {
// The compiler doesn't know the lifetime of attr1.GetOwnerElement
// is guaranteed by the lifetime of attr1, so we hold it explicitly
let attr1owner;
- if let Some(ref a) = other.downcast::<Attr>() {
+ if let Some(a) = other.downcast::<Attr>() {
attr1 = Some(a);
attr1owner = a.GetOwnerElement();
node1 = match attr1owner {
@@ -2964,7 +2964,7 @@ impl NodeMethods for Node {
// step 5.1: spec says to operate on node2 here,
// node2 is definitely just Some(self) going into this step
let attr2owner;
- if let Some(ref a) = self.downcast::<Attr>() {
+ if let Some(a) = self.downcast::<Attr>() {
attr2 = Some(a);
attr2owner = a.GetOwnerElement();
node2 = match attr2owner {
@@ -3176,7 +3176,7 @@ impl VirtualMethods for Node {
}
fn children_changed(&self, mutation: &ChildrenMutation) {
- if let Some(ref s) = self.super_type() {
+ if let Some(s) = self.super_type() {
s.children_changed(mutation);
}
if let Some(list) = self.child_list.get() {