mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-16 09:48:10 +00:00
Merge #7808
7808: Fix assert split exprs on comma r=edwin0cheng a=edwin0cheng bors r+ Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
This commit is contained in:
commit
7f57a01b3d
1 changed files with 2 additions and 17 deletions
|
@ -182,25 +182,10 @@ fn assert_expand(
|
|||
// ```,
|
||||
// which is wrong but useful.
|
||||
|
||||
let mut args = Vec::new();
|
||||
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 args = parse_exprs_with_sep(tt, ',');
|
||||
|
||||
let arg_tts = args.into_iter().flat_map(|arg| {
|
||||
quote! { &(##arg), }
|
||||
quote! { &(#arg), }
|
||||
}.token_trees).collect::<Vec<_>>();
|
||||
|
||||
let expanded = quote! {
|
||||
|
|
Loading…
Reference in a new issue