Skip to content

Commit 6b5b97a

Browse files
committed
Fix incorrect eq_unspanned in TokenStream
1 parent 9f8929f commit 6b5b97a

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

compiler/rustc_ast/src/tokenstream.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -696,14 +696,8 @@ impl TokenStream {
696696

697697
/// Compares two `TokenStream`s, checking equality without regarding span information.
698698
pub fn eq_unspanned(&self, other: &TokenStream) -> bool {
699-
let mut iter1 = self.iter();
700-
let mut iter2 = other.iter();
701-
for (tt1, tt2) in iter::zip(&mut iter1, &mut iter2) {
702-
if !tt1.eq_unspanned(tt2) {
703-
return false;
704-
}
705-
}
706-
iter1.next().is_none() && iter2.next().is_none()
699+
self.len() == other.len()
700+
&& self.iter().zip(other.iter()).all(|(tt1, tt2)| tt1.eq_unspanned(tt2))
707701
}
708702

709703
/// Create a token stream containing a single token with alone spacing. The

0 commit comments

Comments
 (0)