clippy: Fix filter_next warnings (#31965)

This commit is contained in:
Oluwatobi Sofela 2024-04-01 16:44:07 +01:00 committed by GitHub
parent c7b73e1ef4
commit 0a40a800fd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 7 additions and 14 deletions

View file

@ -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()))

View file

@ -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())
}
}

View file

@ -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
}

View file

@ -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)
}
}