Migrate to the 2024 edition (#35755)

* Migrate to 2024 edition

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Allow unsafe_op_in_unsafe_fn lint

This lint warns by default in the 2024
edition, but is *way* too noisy for servo.

We might enable it in the future, but not now.

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Compile using the 2024 edition

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
Simon Wülker 2025-03-13 11:28:11 +01:00 committed by GitHub
parent eb2ca42824
commit bb0d08432e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
66 changed files with 317 additions and 293 deletions

View file

@ -752,14 +752,18 @@ impl Node {
TreeIterator::new(self, shadow_including)
}
pub(crate) fn inclusively_following_siblings(&self) -> impl Iterator<Item = DomRoot<Node>> {
pub(crate) fn inclusively_following_siblings(
&self,
) -> impl Iterator<Item = DomRoot<Node>> + use<> {
SimpleNodeIterator {
current: Some(DomRoot::from_ref(self)),
next_node: |n| n.GetNextSibling(),
}
}
pub(crate) fn inclusively_preceding_siblings(&self) -> impl Iterator<Item = DomRoot<Node>> {
pub(crate) fn inclusively_preceding_siblings(
&self,
) -> impl Iterator<Item = DomRoot<Node>> + use<> {
SimpleNodeIterator {
current: Some(DomRoot::from_ref(self)),
next_node: |n| n.GetPreviousSibling(),
@ -799,14 +803,14 @@ impl Node {
.any(|ancestor| &*ancestor == self)
}
pub(crate) fn following_siblings(&self) -> impl Iterator<Item = DomRoot<Node>> {
pub(crate) fn following_siblings(&self) -> impl Iterator<Item = DomRoot<Node>> + use<> {
SimpleNodeIterator {
current: self.GetNextSibling(),
next_node: |n| n.GetNextSibling(),
}
}
pub(crate) fn preceding_siblings(&self) -> impl Iterator<Item = DomRoot<Node>> {
pub(crate) fn preceding_siblings(&self) -> impl Iterator<Item = DomRoot<Node>> + use<> {
SimpleNodeIterator {
current: self.GetPreviousSibling(),
next_node: |n| n.GetPreviousSibling(),
@ -827,7 +831,7 @@ impl Node {
}
}
pub(crate) fn descending_last_children(&self) -> impl Iterator<Item = DomRoot<Node>> {
pub(crate) fn descending_last_children(&self) -> impl Iterator<Item = DomRoot<Node>> + use<> {
SimpleNodeIterator {
current: self.GetLastChild(),
next_node: |n| n.GetLastChild(),
@ -1090,7 +1094,7 @@ impl Node {
Ok(NodeList::new_simple_list(&window, iter, CanGc::note()))
}
pub(crate) fn ancestors(&self) -> impl Iterator<Item = DomRoot<Node>> {
pub(crate) fn ancestors(&self) -> impl Iterator<Item = DomRoot<Node>> + use<> {
SimpleNodeIterator {
current: self.GetParentNode(),
next_node: |n| n.GetParentNode(),
@ -1101,7 +1105,7 @@ impl Node {
pub(crate) fn inclusive_ancestors(
&self,
shadow_including: ShadowIncluding,
) -> impl Iterator<Item = DomRoot<Node>> {
) -> impl Iterator<Item = DomRoot<Node>> + use<> {
SimpleNodeIterator {
current: Some(DomRoot::from_ref(self)),
next_node: move |n| {
@ -1143,21 +1147,21 @@ impl Node {
self.is_connected() && self.owner_doc().browsing_context().is_some()
}
pub(crate) fn children(&self) -> impl Iterator<Item = DomRoot<Node>> {
pub(crate) fn children(&self) -> impl Iterator<Item = DomRoot<Node>> + use<> {
SimpleNodeIterator {
current: self.GetFirstChild(),
next_node: |n| n.GetNextSibling(),
}
}
pub(crate) fn rev_children(&self) -> impl Iterator<Item = DomRoot<Node>> {
pub(crate) fn rev_children(&self) -> impl Iterator<Item = DomRoot<Node>> + use<> {
SimpleNodeIterator {
current: self.GetLastChild(),
next_node: |n| n.GetPreviousSibling(),
}
}
pub(crate) fn child_elements(&self) -> impl Iterator<Item = DomRoot<Element>> {
pub(crate) fn child_elements(&self) -> impl Iterator<Item = DomRoot<Element>> + use<> {
self.children()
.filter_map(DomRoot::downcast as fn(_) -> _)
.peekable()