File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
compiler/rustc_ast_lowering/src Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -397,13 +397,19 @@ fn expand_format_args<'hir>(
397397 bytecode. extend_from_slice ( & flags. to_le_bytes ( ) ) ;
398398 if let Some ( val) = & o. width {
399399 let ( indirect, val) = make_count ( val, & mut argmap) ;
400- bytecode[ i] |= 1 << 1 | ( indirect as u8 ) << 4 ;
401- bytecode. extend_from_slice ( & val. to_le_bytes ( ) ) ;
400+ if indirect || val != 0 {
401+ // No need to encode zero; that's the default.
402+ bytecode[ i] |= 1 << 1 | ( indirect as u8 ) << 4 ;
403+ bytecode. extend_from_slice ( & val. to_le_bytes ( ) ) ;
404+ }
402405 }
403406 if let Some ( val) = & o. precision {
404407 let ( indirect, val) = make_count ( val, & mut argmap) ;
405- bytecode[ i] |= 1 << 2 | ( indirect as u8 ) << 5 ;
406- bytecode. extend_from_slice ( & val. to_le_bytes ( ) ) ;
408+ if indirect || val != 0 {
409+ // No need to encode zero; that's the default.
410+ bytecode[ i] |= 1 << 2 | ( indirect as u8 ) << 5 ;
411+ bytecode. extend_from_slice ( & val. to_le_bytes ( ) ) ;
412+ }
407413 }
408414 }
409415 if implicit_arg_index != position {
You can’t perform that action at this time.
0 commit comments