From 0a40a800fde3b3812ba3fd2bdee7dd7271d7ecec Mon Sep 17 00:00:00 2001 From: Oluwatobi Sofela <60105594+oluwatobiss@users.noreply.github.com> Date: Mon, 1 Apr 2024 16:44:07 +0100 Subject: clippy: Fix filter_next warnings (#31965) --- components/script/dom/formdata.rs | 3 +-- components/script/dom/htmllabelelement.rs | 3 +-- components/script/dom/node.rs | 12 ++++-------- components/script/dom/xrframe.rs | 3 +-- 4 files changed, 7 insertions(+), 14 deletions(-) (limited to 'components') 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::() .traverse_preorder(ShadowIncluding::No) .filter_map(DomRoot::downcast::) - .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::()) - .next(), + .find(|node| node.is::()), // 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::()) - .next(), + .find(|node| node.is::()), // 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::()) - .next() + .find(|node| node.is::()) } else if next .inclusively_following_siblings() .all(|node| !node.is::()) { // After the last element: Return the last preceding element. prev.inclusively_preceding_siblings() - .filter(|node| node.is::()) - .next() + .find(|node| node.is::()) } 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) } } -- cgit v1.2.3