mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-10 15:14:32 +00:00
Merge #6795
6795: format_args: handle key-value arguments r=jonas-schievink a=jonas-schievink fixes https://github.com/rust-analyzer/rust-analyzer/issues/6728 bors r+ Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
This commit is contained in:
commit
8d5da92e4c
1 changed files with 6 additions and 0 deletions
|
@ -245,6 +245,12 @@ fn format_args_expand(
|
|||
if args.is_empty() {
|
||||
return ExpandResult::only_err(mbe::ExpandError::NoMatchingRule);
|
||||
}
|
||||
for arg in &mut args {
|
||||
// Remove `key =`.
|
||||
if matches!(arg.get(1), Some(tt::TokenTree::Leaf(tt::Leaf::Punct(p))) if p.char == '=') {
|
||||
arg.drain(..2);
|
||||
}
|
||||
}
|
||||
let _format_string = args.remove(0);
|
||||
let arg_tts = args.into_iter().flat_map(|arg| {
|
||||
quote! { std::fmt::ArgumentV1::new(&(##arg), std::fmt::Display::fmt), }
|
||||
|
|
Loading…
Reference in a new issue