mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
clippy: Fix another batch of clippy warnings in components/scripts
(#31912)
* boolean can be simplified * boolean can be simplified * boolean can be simplified
This commit is contained in:
parent
3ddb47e902
commit
af358f51db
2 changed files with 10 additions and 10 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue