Fix == in in format causes mismatched-arg-count

This commit is contained in:
Edwin Cheng 2020-12-31 17:59:29 +08:00
parent a9814fa9c0
commit 74a557857b

View File

@ -259,7 +259,8 @@ fn format_args_expand(
}
for arg in &mut args {
// Remove `key =`.
if matches!(arg.get(1), Some(tt::TokenTree::Leaf(tt::Leaf::Punct(p))) if p.char == '=') {
if matches!(arg.get(1), Some(tt::TokenTree::Leaf(tt::Leaf::Punct(p))) if p.char == '=' && p.spacing != tt::Spacing::Joint)
{
arg.drain(..2);
}
}