@@ -1298,7 +1298,7 @@ impl<'a> Formatter<'a> {
1298
1298
}
1299
1299
1300
1300
// The `width` field is more of a `min-width` parameter at this point.
1301
- match self . width {
1301
+ match self . width ( ) {
1302
1302
// If there's no minimum length requirements then we can just
1303
1303
// write the bytes.
1304
1304
None => {
@@ -1365,12 +1365,12 @@ impl<'a> Formatter<'a> {
1365
1365
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1366
1366
pub fn pad ( & mut self , s : & str ) -> Result {
1367
1367
// 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 ( ) {
1369
1369
return self . buf . write_str ( s) ;
1370
1370
}
1371
1371
// The `precision` field can be interpreted as a `max-width` for the
1372
1372
// string being formatted.
1373
- let s = if let Some ( max) = self . precision {
1373
+ let s = if let Some ( max) = self . precision ( ) {
1374
1374
// If our string is longer that the precision, then we must have
1375
1375
// truncation. However other flags like `fill`, `width` and `align`
1376
1376
// must act as always.
@@ -1387,7 +1387,7 @@ impl<'a> Formatter<'a> {
1387
1387
& s
1388
1388
} ;
1389
1389
// The `width` field is more of a `min-width` parameter at this point.
1390
- match self . width {
1390
+ match self . width ( ) {
1391
1391
// If we're under the maximum length, and there's no minimum length
1392
1392
// requirements, then we can just emit the string
1393
1393
None => self . buf . write_str ( s) ,
@@ -1432,10 +1432,10 @@ impl<'a> Formatter<'a> {
1432
1432
} ;
1433
1433
1434
1434
for _ in 0 ..pre_pad {
1435
- self . buf . write_char ( self . fill ) ?;
1435
+ self . buf . write_char ( self . fill ( ) ) ?;
1436
1436
}
1437
1437
1438
- Ok ( PostPadding :: new ( self . fill , post_pad) )
1438
+ Ok ( PostPadding :: new ( self . fill ( ) , post_pad) )
1439
1439
}
1440
1440
1441
1441
/// Takes the formatted parts and applies the padding.
@@ -1446,12 +1446,12 @@ impl<'a> Formatter<'a> {
1446
1446
///
1447
1447
/// Any `numfmt::Part::Copy` parts in `formatted` must contain valid UTF-8.
1448
1448
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 ( ) {
1450
1450
// for the sign-aware zero padding, we render the sign first and
1451
1451
// behave as if we had no sign from the beginning.
1452
1452
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 ( ) ;
1455
1455
if self . sign_aware_zero_pad ( ) {
1456
1456
// a sign always goes first
1457
1457
let sign = formatted. sign ;
@@ -2384,7 +2384,7 @@ impl Debug for char {
2384
2384
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
2385
2385
impl Display for char {
2386
2386
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 ( ) {
2388
2388
f. write_char ( * self )
2389
2389
} else {
2390
2390
f. pad ( self . encode_utf8 ( & mut [ 0 ; 4 ] ) )
@@ -2408,8 +2408,8 @@ impl<T: ?Sized> Pointer for *const T {
2408
2408
///
2409
2409
/// [problematic]: https://github.com/rust-lang/rust/issues/95489
2410
2410
pub ( 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 ( ) ;
2413
2413
2414
2414
// The alternate flag is already treated by LowerHex as being special-
2415
2415
// 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
2418
2418
if f. alternate ( ) {
2419
2419
f. flags |= 1 << ( rt:: Flag :: SignAwareZeroPad as u32 ) ;
2420
2420
2421
- if f. width . is_none ( ) {
2421
+ if f. width ( ) . is_none ( ) {
2422
2422
f. width = Some ( ( usize:: BITS / 4 ) as usize + 2 ) ;
2423
2423
}
2424
2424
}
0 commit comments