neilconway opened a new issue, #10999:
URL: https://github.com/apache/arrow-rs/issues/10999
### Describe the bug
Display for i256 formats the value through a temporary BigInt with write!(f,
"{}", bigint), which formats it with a default spec and discards the caller's.
Every primitive integer applies the caller's spec through
Formatter::pad_integral, and so does num_bigint::BigInt itself, so i256 is the
only integer type in the workspace for which {:>8}, {:08}, {:+} and friends are
no-ops.
### To Reproduce
```rust
use arrow_buffer::i256;
assert_eq!(format!("{:>8}", 1_i128), " 1");
assert_eq!(format!("{:>8}", i256::ONE), "1"); // expected "
1"
assert_eq!(format!("{:+}", 1_i128), "+1");
assert_eq!(format!("{:+}", i256::ONE), "1"); // expected "+1"
assert_eq!(format!("{:08}", -42_i128), "-0000042");
assert_eq!(format!("{:08}", i256::from_i128(-42)), "-42"); // expected
"-0000042"
assert_eq!(format!("{:*^7}", i256::ONE), "1"); // expected
"***1***"
assert_eq!(format!("{:<6?}", i256::ONE), "1"); // expected "1 "
```
### Expected behavior
i256 should honor the same formatting flags as the primitive integers:
width, fill and alignment, the + sign flag, and 0 padding, for both Display and
Debug.
### Additional context
_No response_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]