mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-17 06:26:55 +00:00
Merge empty delim subtree in proc-macro
This commit is contained in:
parent
da18f11307
commit
72bba98828
@ -76,7 +76,16 @@ impl Extend<TokenTree> for TokenStream {
|
||||
impl Extend<TokenStream> for TokenStream {
|
||||
fn extend<I: IntoIterator<Item = TokenStream>>(&mut self, streams: I) {
|
||||
for item in streams {
|
||||
self.subtree.token_trees.extend(&mut item.into_iter())
|
||||
for tkn in item {
|
||||
match tkn {
|
||||
tt::TokenTree::Subtree(subtree) if subtree.delimiter.is_none() => {
|
||||
self.subtree.token_trees.extend(subtree.token_trees);
|
||||
}
|
||||
_ => {
|
||||
self.subtree.token_trees.push(tkn);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,8 +25,7 @@ SUBTREE $
|
||||
SUBTREE () 4294967295
|
||||
IDENT feature 4294967295
|
||||
PUNCH = [alone] 4294967295
|
||||
SUBTREE $
|
||||
LITERAL "cargo-clippy" 0
|
||||
LITERAL "cargo-clippy" 0
|
||||
PUNCH , [alone] 4294967295
|
||||
IDENT allow 4294967295
|
||||
SUBTREE () 4294967295
|
||||
|
Loading…
Reference in New Issue
Block a user