File tree 2 files changed +7
-12
lines changed
2 files changed +7
-12
lines changed Original file line number Diff line number Diff line change @@ -251,9 +251,13 @@ fn format_args_expand(
251
251
}
252
252
for arg in & mut args {
253
253
// Remove `key =`.
254
- if matches ! ( arg. token_trees. get( 1 ) , Some ( tt:: TokenTree :: Leaf ( tt:: Leaf :: Punct ( p) ) ) if p. char == '=' && p . spacing != tt :: Spacing :: Joint )
254
+ if matches ! ( arg. token_trees. get( 1 ) , Some ( tt:: TokenTree :: Leaf ( tt:: Leaf :: Punct ( p) ) ) if p. char == '=' )
255
255
{
256
- arg. token_trees . drain ( ..2 ) ;
256
+ // but not with `==`
257
+ if !matches ! ( arg. token_trees. get( 2 ) , Some ( tt:: TokenTree :: Leaf ( tt:: Leaf :: Punct ( p) ) ) if p. char == '=' )
258
+ {
259
+ arg. token_trees . drain ( ..2 ) ;
260
+ }
257
261
}
258
262
}
259
263
let _format_string = args. remove ( 0 ) ;
Original file line number Diff line number Diff line change @@ -228,16 +228,7 @@ fn convert_tokens<C: TokenConvertor>(conv: &mut C) -> tt::Subtree {
228
228
}
229
229
230
230
let spacing = match conv. peek ( ) . map ( |next| next. kind ( conv) ) {
231
- Some ( kind)
232
- if !kind. is_trivia ( )
233
- && kind. is_punct ( )
234
- && kind != T ! [ '[' ]
235
- && kind != T ! [ '{' ]
236
- && kind != T ! [ '(' ]
237
- && kind != UNDERSCORE =>
238
- {
239
- tt:: Spacing :: Joint
240
- }
231
+ Some ( kind) if !kind. is_trivia ( ) => tt:: Spacing :: Joint ,
241
232
_ => tt:: Spacing :: Alone ,
242
233
} ;
243
234
let char = match token. to_char ( conv) {
You can’t perform that action at this time.
0 commit comments