@@ -1298,7 +1298,7 @@ impl<'a> Formatter<'a> {
12981298 }
12991299
13001300 // The `width` field is more of a `min-width` parameter at this point.
1301- match self . width {
1301+ match self . width ( ) {
13021302 // If there's no minimum length requirements then we can just
13031303 // write the bytes.
13041304 None => {
@@ -1365,12 +1365,12 @@ impl<'a> Formatter<'a> {
13651365 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
13661366 pub fn pad ( & mut self , s : & str ) -> Result {
13671367 // Make sure there's a fast path up front
1368- if self . width . is_none ( ) && self . precision . is_none ( ) {
1368+ if self . width ( ) . is_none ( ) && self . precision ( ) . is_none ( ) {
13691369 return self . buf . write_str ( s) ;
13701370 }
13711371 // The `precision` field can be interpreted as a `max-width` for the
13721372 // string being formatted.
1373- let s = if let Some ( max) = self . precision {
1373+ let s = if let Some ( max) = self . precision ( ) {
13741374 // If our string is longer that the precision, then we must have
13751375 // truncation. However other flags like `fill`, `width` and `align`
13761376 // must act as always.
@@ -1387,7 +1387,7 @@ impl<'a> Formatter<'a> {
13871387 & s
13881388 } ;
13891389 // The `width` field is more of a `min-width` parameter at this point.
1390- match self . width {
1390+ match self . width ( ) {
13911391 // If we're under the maximum length, and there's no minimum length
13921392 // requirements, then we can just emit the string
13931393 None => self . buf . write_str ( s) ,
@@ -1432,10 +1432,10 @@ impl<'a> Formatter<'a> {
14321432 } ;
14331433
14341434 for _ in 0 ..pre_pad {
1435- self . buf . write_char ( self . fill ) ?;
1435+ self . buf . write_char ( self . fill ( ) ) ?;
14361436 }
14371437
1438- Ok ( PostPadding :: new ( self . fill , post_pad) )
1438+ Ok ( PostPadding :: new ( self . fill ( ) , post_pad) )
14391439 }
14401440
14411441 /// Takes the formatted parts and applies the padding.
@@ -1446,12 +1446,12 @@ impl<'a> Formatter<'a> {
14461446 ///
14471447 /// Any `numfmt::Part::Copy` parts in `formatted` must contain valid UTF-8.
14481448 unsafe fn pad_formatted_parts ( & mut self , formatted : & numfmt:: Formatted < ' _ > ) -> Result {
1449- if let Some ( mut width) = self . width {
1449+ if let Some ( mut width) = self . width ( ) {
14501450 // for the sign-aware zero padding, we render the sign first and
14511451 // behave as if we had no sign from the beginning.
14521452 let mut formatted = formatted. clone ( ) ;
1453- let old_fill = self . fill ;
1454- let old_align = self . align ;
1453+ let old_fill = self . fill ( ) ;
1454+ let old_align = self . align ( ) ;
14551455 if self . sign_aware_zero_pad ( ) {
14561456 // a sign always goes first
14571457 let sign = formatted. sign ;
@@ -2384,7 +2384,7 @@ impl Debug for char {
23842384#[ stable( feature = "rust1" , since = "1.0.0" ) ]
23852385impl Display for char {
23862386 fn fmt ( & self , f : & mut Formatter < ' _ > ) -> Result {
2387- if f. width . is_none ( ) && f. precision . is_none ( ) {
2387+ if f. width ( ) . is_none ( ) && f. precision ( ) . is_none ( ) {
23882388 f. write_char ( * self )
23892389 } else {
23902390 f. pad ( self . encode_utf8 ( & mut [ 0 ; 4 ] ) )
@@ -2408,8 +2408,8 @@ impl<T: ?Sized> Pointer for *const T {
24082408///
24092409/// [problematic]: https://github.com/rust-lang/rust/issues/95489
24102410pub ( crate ) fn pointer_fmt_inner ( ptr_addr : usize , f : & mut Formatter < ' _ > ) -> Result {
2411- let old_width = f. width ;
2412- let old_flags = f. flags ;
2411+ let old_width = f. width ( ) ;
2412+ let old_flags = f. flags ( ) ;
24132413
24142414 // The alternate flag is already treated by LowerHex as being special-
24152415 // it denotes whether to prefix with 0x. We use it to work out whether
@@ -2418,7 +2418,7 @@ pub(crate) fn pointer_fmt_inner(ptr_addr: usize, f: &mut Formatter<'_>) -> Resul
24182418 if f. alternate ( ) {
24192419 f. flags |= 1 << ( rt:: Flag :: SignAwareZeroPad as u32 ) ;
24202420
2421- if f. width . is_none ( ) {
2421+ if f. width ( ) . is_none ( ) {
24222422 f. width = Some ( ( usize:: BITS / 4 ) as usize + 2 ) ;
24232423 }
24242424 }
0 commit comments