diff options
| author | yukang <moorekang@gmail.com> | 2025-05-26 14:11:02 +0800 |
|---|---|---|
| committer | yukang <moorekang@gmail.com> | 2025-05-26 17:02:51 +0800 |
| commit | d3347bb32b01e73db96d75579ec7ca16320d4317 (patch) | |
| tree | b72eb2798d808de562067f2e85ff5b5bc35043b2 /compiler/rustc_ast/src/tokenstream.rs | |
| parent | 6b5b97a4df3331e82ee7f57f2c33818b997f98d0 (diff) | |
| download | rust-d3347bb32b01e73db96d75579ec7ca16320d4317.tar.gz rust-d3347bb32b01e73db96d75579ec7ca16320d4317.zip | |
remove eq_unspanned from TokenStream
Diffstat (limited to 'compiler/rustc_ast/src/tokenstream.rs')
| -rw-r--r-- | compiler/rustc_ast/src/tokenstream.rs | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/compiler/rustc_ast/src/tokenstream.rs b/compiler/rustc_ast/src/tokenstream.rs index 7f2ba28f81b..3c231be20dc 100644 --- a/compiler/rustc_ast/src/tokenstream.rs +++ b/compiler/rustc_ast/src/tokenstream.rs @@ -57,7 +57,9 @@ impl TokenTree { match (self, other) { (TokenTree::Token(token, _), TokenTree::Token(token2, _)) => token.kind == token2.kind, (TokenTree::Delimited(.., delim, tts), TokenTree::Delimited(.., delim2, tts2)) => { - delim == delim2 && tts.eq_unspanned(tts2) + delim == delim2 + && tts.len() == tts2.len() + && tts.iter().zip(tts2.iter()).all(|(a, b)| a.eq_unspanned(b)) } _ => false, } @@ -694,12 +696,6 @@ impl TokenStream { TokenStreamIter::new(self) } - /// Compares two `TokenStream`s, checking equality without regarding span information. - pub fn eq_unspanned(&self, other: &TokenStream) -> bool { - self.len() == other.len() - && self.iter().zip(other.iter()).all(|(tt1, tt2)| tt1.eq_unspanned(tt2)) - } - /// Create a token stream containing a single token with alone spacing. The /// spacing used for the final token in a constructed stream doesn't matter /// because it's never used. In practice we arbitrarily use |
