style: Inline DomDescendants.
draft
--- a/servo/components/style/dom.rs
+++ b/servo/components/style/dom.rs
@@ -117,16 +117,17 @@ pub struct DomDescendants<N> {
}
impl<N> Iterator for DomDescendants<N>
where
N: TNode
{
type Item = N;
+ #[inline]
fn next(&mut self) -> Option<N> {
let prev = match self.previous.take() {
None => return None,
Some(n) => n,
};
self.previous = prev.next_in_preorder(Some(self.scope));
self.previous
@@ -200,16 +201,17 @@ pub trait TNode : Sized + Copy + Clone +
DomDescendants {
previous: Some(*self),
scope: *self,
}
}
/// Returns the next children in pre-order, optionally scoped to a subtree
/// root.
+ #[inline]
fn next_in_preorder(&self, scoped_to: Option<Self>) -> Option<Self> {
if let Some(c) = self.first_child() {
return Some(c);
}
if Some(*self) == scoped_to {
return None;
}