@@ -1365,7 +1365,7 @@ impl<'a> Formatter<'a> {
1365
1365
}
1366
1366
1367
1367
// The `width` field is more of a `min-width` parameter at this point.
1368
- match self . width {
1368
+ match self . width ( ) {
1369
1369
// If there's no minimum length requirements then we can just
1370
1370
// write the bytes.
1371
1371
None => {
@@ -1433,12 +1433,12 @@ impl<'a> Formatter<'a> {
1433
1433
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1434
1434
pub fn pad ( & mut self , s : & str ) -> Result {
1435
1435
// 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 ( ) {
1437
1437
return self . buf . write_str ( s) ;
1438
1438
}
1439
1439
// The `precision` field can be interpreted as a `max-width` for the
1440
1440
// string being formatted.
1441
- let s = if let Some ( max) = self . precision {
1441
+ let s = if let Some ( max) = self . precision ( ) {
1442
1442
// If our string is longer that the precision, then we must have
1443
1443
// truncation. However other flags like `fill`, `width` and `align`
1444
1444
// must act as always.
@@ -1455,7 +1455,7 @@ impl<'a> Formatter<'a> {
1455
1455
& s
1456
1456
} ;
1457
1457
// The `width` field is more of a `min-width` parameter at this point.
1458
- match self . width {
1458
+ match self . width ( ) {
1459
1459
// If we're under the maximum length, and there's no minimum length
1460
1460
// requirements, then we can just emit the string
1461
1461
None => self . buf . write_str ( s) ,
@@ -1501,10 +1501,10 @@ impl<'a> Formatter<'a> {
1501
1501
} ;
1502
1502
1503
1503
for _ in 0 ..pre_pad {
1504
- self . buf . write_char ( self . fill ) ?;
1504
+ self . buf . write_char ( self . fill ( ) ) ?;
1505
1505
}
1506
1506
1507
- Ok ( PostPadding :: new ( self . fill , post_pad) )
1507
+ Ok ( PostPadding :: new ( self . fill ( ) , post_pad) )
1508
1508
}
1509
1509
1510
1510
/// Takes the formatted parts and applies the padding.
@@ -1516,12 +1516,12 @@ impl<'a> Formatter<'a> {
1516
1516
///
1517
1517
/// Any `numfmt::Part::Copy` parts in `formatted` must contain valid UTF-8.
1518
1518
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 ( ) {
1520
1520
// for the sign-aware zero padding, we render the sign first and
1521
1521
// behave as if we had no sign from the beginning.
1522
1522
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 ( ) ;
1525
1525
if self . sign_aware_zero_pad ( ) {
1526
1526
// a sign always goes first
1527
1527
let sign = formatted. sign ;
@@ -2502,7 +2502,7 @@ impl Debug for char {
2502
2502
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
2503
2503
impl Display for char {
2504
2504
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 ( ) {
2506
2506
f. write_char ( * self )
2507
2507
} else {
2508
2508
f. pad ( self . encode_utf8 ( & mut [ 0 ; 4 ] ) )
@@ -2526,8 +2526,8 @@ impl<T: ?Sized> Pointer for *const T {
2526
2526
///
2527
2527
/// [problematic]: https://github.com/rust-lang/rust/issues/95489
2528
2528
pub ( 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 ( ) ;
2531
2531
2532
2532
// The alternate flag is already treated by LowerHex as being special-
2533
2533
// 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
2536
2536
if f. alternate ( ) {
2537
2537
f. flags |= 1 << ( rt:: Flag :: SignAwareZeroPad as u32 ) ;
2538
2538
2539
- if f. width . is_none ( ) {
2539
+ if f. width ( ) . is_none ( ) {
2540
2540
f. width = Some ( ( usize:: BITS / 4 ) as usize + 2 ) ;
2541
2541
}
2542
2542
}
0 commit comments