aboutsummaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorOluwatobi Sofela <60105594+oluwatobiss@users.noreply.github.com>2024-04-01 16:44:07 +0100
committerGitHub <noreply@github.com>2024-04-01 15:44:07 +0000
commit0a40a800fde3b3812ba3fd2bdee7dd7271d7ecec (patch)
tree499866565f6444d81a7363e24fb8509a623e1e7a /components
parentc7b73e1ef4dc54ea74d63d3cec0cf7fe0fab218a (diff)
downloadservo-0a40a800fde3b3812ba3fd2bdee7dd7271d7ecec.tar.gz
servo-0a40a800fde3b3812ba3fd2bdee7dd7271d7ecec.zip
clippy: Fix filter_next warnings (#31965)
Diffstat (limited to 'components')
-rw-r--r--components/script/dom/formdata.rs3
-rw-r--r--components/script/dom/htmllabelelement.rs3
-rw-r--r--components/script/dom/node.rs12
-rw-r--r--components/script/dom/xrframe.rs3
4 files changed, 7 insertions, 14 deletions
diff --git a/components/script/dom/formdata.rs b/components/script/dom/formdata.rs
index f8b657b782b..a6da80796c5 100644
--- a/components/script/dom/formdata.rs
+++ b/components/script/dom/formdata.rs
@@ -118,8 +118,7 @@ impl FormDataMethods for FormData {
self.data
.borrow()
.iter()
- .filter(|(datum_name, _)| datum_name.0 == name.0)
- .next()
+ .find(|(datum_name, _)| datum_name.0 == name.0)
.map(|(_, datum)| match &datum.value {
FormDatumValue::String(ref s) => {
FileOrUSVString::USVString(USVString(s.to_string()))
diff --git a/components/script/dom/htmllabelelement.rs b/components/script/dom/htmllabelelement.rs
index 4f608afcff5..b73a5a9949c 100644
--- a/components/script/dom/htmllabelelement.rs
+++ b/components/script/dom/htmllabelelement.rs
@@ -170,8 +170,7 @@ impl HTMLLabelElement {
self.upcast::<Node>()
.traverse_preorder(ShadowIncluding::No)
.filter_map(DomRoot::downcast::<HTMLElement>)
- .filter(|elem| elem.is_labelable_element())
- .next()
+ .find(|elem| elem.is_labelable_element())
}
}
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs
index aedd70442a9..d8eee328712 100644
--- a/components/script/dom/node.rs
+++ b/components/script/dom/node.rs
@@ -3309,8 +3309,7 @@ impl<'a> ChildrenMutation<'a> {
..
} => next
.inclusively_following_siblings()
- .filter(|node| node.is::<Element>())
- .next(),
+ .find(|node| node.is::<Element>()),
// Add/remove at end of container: Return the last preceding element.
ChildrenMutation::Append { prev, .. } |
ChildrenMutation::Replace {
@@ -3319,8 +3318,7 @@ impl<'a> ChildrenMutation<'a> {
..
} => prev
.inclusively_preceding_siblings()
- .filter(|node| node.is::<Element>())
- .next(),
+ .find(|node| node.is::<Element>()),
// Insert or replace in the middle:
ChildrenMutation::Insert { prev, next, .. } |
ChildrenMutation::Replace {
@@ -3334,16 +3332,14 @@ impl<'a> ChildrenMutation<'a> {
{
// Before the first element: Return the first following element.
next.inclusively_following_siblings()
- .filter(|node| node.is::<Element>())
- .next()
+ .find(|node| node.is::<Element>())
} else if next
.inclusively_following_siblings()
.all(|node| !node.is::<Element>())
{
// After the last element: Return the last preceding element.
prev.inclusively_preceding_siblings()
- .filter(|node| node.is::<Element>())
- .next()
+ .find(|node| node.is::<Element>())
} else {
None
}
diff --git a/components/script/dom/xrframe.rs b/components/script/dom/xrframe.rs
index 05788baa5d2..604ec422800 100644
--- a/components/script/dom/xrframe.rs
+++ b/components/script/dom/xrframe.rs
@@ -67,8 +67,7 @@ impl XRFrame {
self.data
.sub_images
.iter()
- .filter(|sub_images| sub_images.layer_id == layer_id)
- .next()
+ .find(|sub_images| sub_images.layer_id == layer_id)
}
}