@@ -292,7 +292,7 @@ pub struct FormattingOptions {
292
292
sign_aware_zero_pad : bool ,
293
293
alternate : bool ,
294
294
fill : char ,
295
- alignment : Option < Alignment > ,
295
+ align : Option < Alignment > ,
296
296
width : Option < usize > ,
297
297
precision : Option < usize > ,
298
298
debug_as_hex : Option < DebugAsHex > ,
@@ -316,7 +316,7 @@ impl FormattingOptions {
316
316
sign_aware_zero_pad : false ,
317
317
alternate : false ,
318
318
fill : ' ' ,
319
- alignment : None ,
319
+ align : None ,
320
320
width : None ,
321
321
precision : None ,
322
322
debug_as_hex : None ,
@@ -373,15 +373,15 @@ impl FormattingOptions {
373
373
/// The alignment specifies how the value being formatted should be
374
374
/// positioned if it is smaller than the width of the formatter.
375
375
#[ unstable( feature = "formatting_options" , issue = "118117" ) ]
376
- pub fn alignment ( & mut self , alignment : Option < Alignment > ) -> & mut Self {
377
- self . alignment = alignment ;
376
+ pub fn align ( & mut self , align : Option < Alignment > ) -> & mut Self {
377
+ self . align = align ;
378
378
self
379
379
}
380
380
/// Sets or removes the width.
381
381
///
382
382
/// This is a parameter for the “minimum width” that the format should take
383
383
/// up. If the value’s string does not fill up this many characters, then
384
- /// the padding specified by [`FormattingOptions::fill`]/[`FormattingOptions::alignment `]
384
+ /// the padding specified by [`FormattingOptions::fill`]/[`FormattingOptions::align `]
385
385
/// will be used to take up the required space.
386
386
#[ unstable( feature = "formatting_options" , issue = "118117" ) ]
387
387
pub fn width ( & mut self , width : Option < usize > ) -> & mut Self {
@@ -432,8 +432,8 @@ impl FormattingOptions {
432
432
}
433
433
/// Returns the current alignment.
434
434
#[ unstable( feature = "formatting_options" , issue = "118117" ) ]
435
- pub fn get_alignment ( & self ) -> Option < Alignment > {
436
- self . alignment
435
+ pub fn get_align ( & self ) -> Option < Alignment > {
436
+ self . align
437
437
}
438
438
/// Returns the current width.
439
439
#[ unstable( feature = "formatting_options" , issue = "118117" ) ]
@@ -1459,7 +1459,7 @@ pub fn write(output: &mut dyn Write, args: Arguments<'_>) -> Result {
1459
1459
1460
1460
unsafe fn run ( fmt : & mut Formatter < ' _ > , arg : & rt:: Placeholder , args : & [ rt:: Argument < ' _ > ] ) -> Result {
1461
1461
fmt. options . fill ( arg. fill ) ;
1462
- fmt. options . alignment ( arg. align . into ( ) ) ;
1462
+ fmt. options . align ( arg. align . into ( ) ) ;
1463
1463
fmt. options . flags ( arg. flags ) ;
1464
1464
// SAFETY: arg and args come from the same Arguments,
1465
1465
// which guarantees the indexes are always within bounds.
@@ -1623,13 +1623,13 @@ impl<'a> Formatter<'a> {
1623
1623
Some ( min) if self . sign_aware_zero_pad ( ) => {
1624
1624
let old_fill = crate :: mem:: replace ( & mut self . options . fill , '0' ) ;
1625
1625
let old_align =
1626
- crate :: mem:: replace ( & mut self . options . alignment , Some ( Alignment :: Right ) ) ;
1626
+ crate :: mem:: replace ( & mut self . options . align , Some ( Alignment :: Right ) ) ;
1627
1627
write_prefix ( self , sign, prefix) ?;
1628
1628
let post_padding = self . padding ( min - width, Alignment :: Right ) ?;
1629
1629
self . buf . write_str ( buf) ?;
1630
1630
post_padding. write ( self ) ?;
1631
1631
self . options . fill = old_fill;
1632
- self . options . alignment = old_align;
1632
+ self . options . align = old_align;
1633
1633
Ok ( ( ) )
1634
1634
}
1635
1635
// Otherwise, the sign and prefix goes after the padding
@@ -1767,7 +1767,7 @@ impl<'a> Formatter<'a> {
1767
1767
formatted. sign = "" ;
1768
1768
width = width. saturating_sub ( sign. len ( ) ) ;
1769
1769
self . options . fill ( '0' ) ;
1770
- self . options . alignment ( Some ( Alignment :: Right ) ) ;
1770
+ self . options . align ( Some ( Alignment :: Right ) ) ;
1771
1771
}
1772
1772
1773
1773
// remaining parts go through the ordinary padding process.
@@ -1785,7 +1785,7 @@ impl<'a> Formatter<'a> {
1785
1785
post_padding. write ( self )
1786
1786
} ;
1787
1787
self . options . fill ( old_fill) ;
1788
- self . options . alignment ( old_align) ;
1788
+ self . options . align ( old_align) ;
1789
1789
ret
1790
1790
} else {
1791
1791
// this is the common case and we take a shortcut
@@ -1979,7 +1979,7 @@ impl<'a> Formatter<'a> {
1979
1979
#[ must_use]
1980
1980
#[ stable( feature = "fmt_flags_align" , since = "1.28.0" ) ]
1981
1981
pub fn align ( & self ) -> Option < Alignment > {
1982
- self . options . get_alignment ( )
1982
+ self . options . get_align ( )
1983
1983
}
1984
1984
1985
1985
/// Returns the optionally specified integer width that the output should be.
0 commit comments