Skip to content

Commit

Permalink
Drop tokens in order instead of reversed order
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Jan 11, 2025
1 parent 172907a commit 029360d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/fallback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,11 @@ impl Drop for TokenStream {
fn drop(&mut self) {
let mut stack = Vec::new();
let mut current = match self.inner.get_mut() {
Some(inner) => inner.take(),
Some(inner) => inner.take().into_iter(),
None => return,
};
loop {
while let Some(token) = current.pop() {
while let Some(token) = current.next() {
let group = match token {
TokenTree::Group(group) => group.inner,
_ => continue,
Expand All @@ -144,7 +144,7 @@ impl Drop for TokenStream {
let mut group = group;
if let Some(inner) = group.stream.inner.get_mut() {
stack.push(current);
current = inner.take();
current = inner.take().into_iter();
}
}
match stack.pop() {
Expand Down
4 changes: 0 additions & 4 deletions src/rcvec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,6 @@ impl<T> RcVecBuilder<T> {
self.inner.extend(iter);
}

pub(crate) fn pop(&mut self) -> Option<T> {
self.inner.pop()
}

pub(crate) fn as_mut(&mut self) -> RcVecMut<T> {
RcVecMut {
inner: &mut self.inner,
Expand Down

0 comments on commit 029360d

Please sign in to comment.