mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Merge empty delim subtree in proc-macro
This commit is contained in:
parent
da18f11307
commit
72bba98828
2 changed files with 11 additions and 3 deletions
|
@ -76,7 +76,16 @@ impl Extend<TokenTree> for TokenStream {
|
||||||
impl Extend<TokenStream> for TokenStream {
|
impl Extend<TokenStream> for TokenStream {
|
||||||
fn extend<I: IntoIterator<Item = TokenStream>>(&mut self, streams: I) {
|
fn extend<I: IntoIterator<Item = TokenStream>>(&mut self, streams: I) {
|
||||||
for item in streams {
|
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
|
SUBTREE () 4294967295
|
||||||
IDENT feature 4294967295
|
IDENT feature 4294967295
|
||||||
PUNCH = [alone] 4294967295
|
PUNCH = [alone] 4294967295
|
||||||
SUBTREE $
|
LITERAL "cargo-clippy" 0
|
||||||
LITERAL "cargo-clippy" 0
|
|
||||||
PUNCH , [alone] 4294967295
|
PUNCH , [alone] 4294967295
|
||||||
IDENT allow 4294967295
|
IDENT allow 4294967295
|
||||||
SUBTREE () 4294967295
|
SUBTREE () 4294967295
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue