@@ -276,7 +276,7 @@ pub struct FormattingOptions {
276
276
sign_aware_zero_pad : bool ,
277
277
alternate : bool ,
278
278
fill : char ,
279
- alignment : Option < Alignment > ,
279
+ align : Option < Alignment > ,
280
280
width : Option < usize > ,
281
281
precision : Option < usize > ,
282
282
debug_as_hex : Option < DebugAsHex > ,
@@ -300,7 +300,7 @@ impl FormattingOptions {
300
300
sign_aware_zero_pad : false ,
301
301
alternate : false ,
302
302
fill : ' ' ,
303
- alignment : None ,
303
+ align : None ,
304
304
width : None ,
305
305
precision : None ,
306
306
debug_as_hex : None ,
@@ -357,15 +357,15 @@ impl FormattingOptions {
357
357
/// The alignment specifies how the value being formatted should be
358
358
/// positioned if it is smaller than the width of the formatter.
359
359
#[ unstable( feature = "formatting_options" , issue = "118117" ) ]
360
- pub fn alignment ( & mut self , alignment : Option < Alignment > ) -> & mut Self {
361
- self . alignment = alignment ;
360
+ pub fn align ( & mut self , align : Option < Alignment > ) -> & mut Self {
361
+ self . align = align ;
362
362
self
363
363
}
364
364
/// Sets or removes the width.
365
365
///
366
366
/// This is a parameter for the “minimum width” that the format should take
367
367
/// up. If the value’s string does not fill up this many characters, then
368
- /// the padding specified by [`FormattingOptions::fill`]/[`FormattingOptions::alignment `]
368
+ /// the padding specified by [`FormattingOptions::fill`]/[`FormattingOptions::align `]
369
369
/// will be used to take up the required space.
370
370
#[ unstable( feature = "formatting_options" , issue = "118117" ) ]
371
371
pub fn width ( & mut self , width : Option < usize > ) -> & mut Self {
@@ -416,8 +416,8 @@ impl FormattingOptions {
416
416
}
417
417
/// Returns the current alignment.
418
418
#[ unstable( feature = "formatting_options" , issue = "118117" ) ]
419
- pub fn get_alignment ( & self ) -> Option < Alignment > {
420
- self . alignment
419
+ pub fn get_align ( & self ) -> Option < Alignment > {
420
+ self . align
421
421
}
422
422
/// Returns the current width.
423
423
#[ unstable( feature = "formatting_options" , issue = "118117" ) ]
@@ -1393,7 +1393,7 @@ pub fn write(output: &mut dyn Write, args: Arguments<'_>) -> Result {
1393
1393
1394
1394
unsafe fn run ( fmt : & mut Formatter < ' _ > , arg : & rt:: Placeholder , args : & [ rt:: Argument < ' _ > ] ) -> Result {
1395
1395
fmt. options . fill ( arg. fill ) ;
1396
- fmt. options . alignment ( arg. align . into ( ) ) ;
1396
+ fmt. options . align ( arg. align . into ( ) ) ;
1397
1397
fmt. options . flags ( arg. flags ) ;
1398
1398
// SAFETY: arg and args come from the same Arguments,
1399
1399
// which guarantees the indexes are always within bounds.
@@ -1556,13 +1556,13 @@ impl<'a> Formatter<'a> {
1556
1556
Some ( min) if self . sign_aware_zero_pad ( ) => {
1557
1557
let old_fill = crate :: mem:: replace ( & mut self . options . fill , '0' ) ;
1558
1558
let old_align =
1559
- crate :: mem:: replace ( & mut self . options . alignment , Some ( Alignment :: Right ) ) ;
1559
+ crate :: mem:: replace ( & mut self . options . align , Some ( Alignment :: Right ) ) ;
1560
1560
write_prefix ( self , sign, prefix) ?;
1561
1561
let post_padding = self . padding ( min - width, Alignment :: Right ) ?;
1562
1562
self . buf . write_str ( buf) ?;
1563
1563
post_padding. write ( self ) ?;
1564
1564
self . options . fill = old_fill;
1565
- self . options . alignment = old_align;
1565
+ self . options . align = old_align;
1566
1566
Ok ( ( ) )
1567
1567
}
1568
1568
// Otherwise, the sign and prefix goes after the padding
@@ -1697,7 +1697,7 @@ impl<'a> Formatter<'a> {
1697
1697
formatted. sign = "" ;
1698
1698
width = width. saturating_sub ( sign. len ( ) ) ;
1699
1699
self . options . fill ( '0' ) ;
1700
- self . options . alignment ( Some ( Alignment :: Right ) ) ;
1700
+ self . options . align ( Some ( Alignment :: Right ) ) ;
1701
1701
}
1702
1702
1703
1703
// remaining parts go through the ordinary padding process.
@@ -1715,7 +1715,7 @@ impl<'a> Formatter<'a> {
1715
1715
post_padding. write ( self )
1716
1716
} ;
1717
1717
self . options . fill ( old_fill) ;
1718
- self . options . alignment ( old_align) ;
1718
+ self . options . align ( old_align) ;
1719
1719
ret
1720
1720
} else {
1721
1721
// this is the common case and we take a shortcut
@@ -1899,7 +1899,7 @@ impl<'a> Formatter<'a> {
1899
1899
#[ must_use]
1900
1900
#[ stable( feature = "fmt_flags_align" , since = "1.28.0" ) ]
1901
1901
pub fn align ( & self ) -> Option < Alignment > {
1902
- self . options . get_alignment ( )
1902
+ self . options . get_align ( )
1903
1903
}
1904
1904
1905
1905
/// Optionally specified integer width that the output should be.
0 commit comments