mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
Fix assert split exprs on comma
This commit is contained in:
parent
c412d5f8d1
commit
30402beeb2
1 changed files with 2 additions and 17 deletions
|
@ -182,25 +182,10 @@ fn assert_expand(
|
||||||
// ```,
|
// ```,
|
||||||
// which is wrong but useful.
|
// which is wrong but useful.
|
||||||
|
|
||||||
let mut args = Vec::new();
|
let args = parse_exprs_with_sep(tt, ',');
|
||||||
let mut current = Vec::new();
|
|
||||||
for tt in tt.token_trees.iter().cloned() {
|
|
||||||
match tt {
|
|
||||||
tt::TokenTree::Leaf(tt::Leaf::Punct(p)) if p.char == ',' => {
|
|
||||||
args.push(current);
|
|
||||||
current = Vec::new();
|
|
||||||
}
|
|
||||||
_ => {
|
|
||||||
current.push(tt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if !current.is_empty() {
|
|
||||||
args.push(current);
|
|
||||||
}
|
|
||||||
|
|
||||||
let arg_tts = args.into_iter().flat_map(|arg| {
|
let arg_tts = args.into_iter().flat_map(|arg| {
|
||||||
quote! { &(##arg), }
|
quote! { &(#arg), }
|
||||||
}.token_trees).collect::<Vec<_>>();
|
}.token_trees).collect::<Vec<_>>();
|
||||||
|
|
||||||
let expanded = quote! {
|
let expanded = quote! {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue