We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9f8929f commit 6b5b97aCopy full SHA for 6b5b97a
compiler/rustc_ast/src/tokenstream.rs
@@ -696,14 +696,8 @@ impl TokenStream {
696
697
/// Compares two `TokenStream`s, checking equality without regarding span information.
698
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()
+ self.len() == other.len()
+ && self.iter().zip(other.iter()).all(|(tt1, tt2)| tt1.eq_unspanned(tt2))
707
}
708
709
/// Create a token stream containing a single token with alone spacing. The
0 commit comments