@@ -1365,7 +1365,7 @@ impl<'a> Formatter<'a> {
13651365 }
13661366
13671367 // The `width` field is more of a `min-width` parameter at this point.
1368- match self . width {
1368+ match self . width ( ) {
13691369 // If there's no minimum length requirements then we can just
13701370 // write the bytes.
13711371 None => {
@@ -1433,12 +1433,12 @@ impl<'a> Formatter<'a> {
14331433 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
14341434 pub fn pad ( & mut self , s : & str ) -> Result {
14351435 // Make sure there's a fast path up front
1436- if self . width . is_none ( ) && self . precision . is_none ( ) {
1436+ if self . width ( ) . is_none ( ) && self . precision ( ) . is_none ( ) {
14371437 return self . buf . write_str ( s) ;
14381438 }
14391439 // The `precision` field can be interpreted as a `max-width` for the
14401440 // string being formatted.
1441- let s = if let Some ( max) = self . precision {
1441+ let s = if let Some ( max) = self . precision ( ) {
14421442 // If our string is longer that the precision, then we must have
14431443 // truncation. However other flags like `fill`, `width` and `align`
14441444 // must act as always.
@@ -1455,7 +1455,7 @@ impl<'a> Formatter<'a> {
14551455 & s
14561456 } ;
14571457 // The `width` field is more of a `min-width` parameter at this point.
1458- match self . width {
1458+ match self . width ( ) {
14591459 // If we're under the maximum length, and there's no minimum length
14601460 // requirements, then we can just emit the string
14611461 None => self . buf . write_str ( s) ,
@@ -1501,10 +1501,10 @@ impl<'a> Formatter<'a> {
15011501 } ;
15021502
15031503 for _ in 0 ..pre_pad {
1504- self . buf . write_char ( self . fill ) ?;
1504+ self . buf . write_char ( self . fill ( ) ) ?;
15051505 }
15061506
1507- Ok ( PostPadding :: new ( self . fill , post_pad) )
1507+ Ok ( PostPadding :: new ( self . fill ( ) , post_pad) )
15081508 }
15091509
15101510 /// Takes the formatted parts and applies the padding.
@@ -1516,12 +1516,12 @@ impl<'a> Formatter<'a> {
15161516 ///
15171517 /// Any `numfmt::Part::Copy` parts in `formatted` must contain valid UTF-8.
15181518 unsafe fn pad_formatted_parts ( & mut self , formatted : & numfmt:: Formatted < ' _ > ) -> Result {
1519- if let Some ( mut width) = self . width {
1519+ if let Some ( mut width) = self . width ( ) {
15201520 // for the sign-aware zero padding, we render the sign first and
15211521 // behave as if we had no sign from the beginning.
15221522 let mut formatted = formatted. clone ( ) ;
1523- let old_fill = self . fill ;
1524- let old_align = self . align ;
1523+ let old_fill = self . fill ( ) ;
1524+ let old_align = self . align ( ) ;
15251525 if self . sign_aware_zero_pad ( ) {
15261526 // a sign always goes first
15271527 let sign = formatted. sign ;
@@ -2502,7 +2502,7 @@ impl Debug for char {
25022502#[ stable( feature = "rust1" , since = "1.0.0" ) ]
25032503impl Display for char {
25042504 fn fmt ( & self , f : & mut Formatter < ' _ > ) -> Result {
2505- if f. width . is_none ( ) && f. precision . is_none ( ) {
2505+ if f. width ( ) . is_none ( ) && f. precision ( ) . is_none ( ) {
25062506 f. write_char ( * self )
25072507 } else {
25082508 f. pad ( self . encode_utf8 ( & mut [ 0 ; 4 ] ) )
@@ -2526,8 +2526,8 @@ impl<T: ?Sized> Pointer for *const T {
25262526///
25272527/// [problematic]: https://github.com/rust-lang/rust/issues/95489
25282528pub ( crate ) fn pointer_fmt_inner ( ptr_addr : usize , f : & mut Formatter < ' _ > ) -> Result {
2529- let old_width = f. width ;
2530- let old_flags = f. flags ;
2529+ let old_width = f. width ( ) ;
2530+ let old_flags = f. flags ( ) ;
25312531
25322532 // The alternate flag is already treated by LowerHex as being special-
25332533 // it denotes whether to prefix with 0x. We use it to work out whether
@@ -2536,7 +2536,7 @@ pub(crate) fn pointer_fmt_inner(ptr_addr: usize, f: &mut Formatter<'_>) -> Resul
25362536 if f. alternate ( ) {
25372537 f. flags |= 1 << ( rt:: Flag :: SignAwareZeroPad as u32 ) ;
25382538
2539- if f. width . is_none ( ) {
2539+ if f. width ( ) . is_none ( ) {
25402540 f. width = Some ( ( usize:: BITS / 4 ) as usize + 2 ) ;
25412541 }
25422542 }
0 commit comments