fmt: get rid of Decimal::end

It's not used. I believe it was being used when `Decimal` was also
responsible for formatting the fractional part of a floating point
number. But it isn't needed any more.
This commit is contained in:
Andrew Gallant 2025-12-22 20:44:21 -05:00
parent 9c6a331a89
commit 01bbfa9967
No known key found for this signature in database
GPG key ID: B2E3A4923F8B0D44

View file

@ -83,7 +83,6 @@ impl Default for DecimalFormatter {
pub(crate) struct Decimal {
buf: [u8; Self::MAX_LEN as usize],
start: u8,
end: u8,
}
impl Decimal {
@ -98,11 +97,8 @@ impl Decimal {
formatter: &DecimalFormatter,
mut value: u64,
) -> Decimal {
let mut decimal = Decimal {
buf: [0; Self::MAX_LEN as usize],
start: Self::MAX_LEN,
end: Self::MAX_LEN,
};
let mut decimal =
Decimal { buf: [0; Self::MAX_LEN as usize], start: Self::MAX_LEN };
loop {
decimal.start -= 1;
@ -147,7 +143,7 @@ impl Decimal {
/// used to represent this decimal number.
#[inline]
const fn len(&self) -> u8 {
self.end - self.start
Self::MAX_LEN - self.start
}
/// Returns the ASCII representation of this decimal as a byte slice.
@ -155,7 +151,7 @@ impl Decimal {
/// The slice returned is guaranteed to be valid ASCII.
#[inline]
fn as_bytes(&self) -> &[u8] {
&self.buf[usize::from(self.start)..usize::from(self.end)]
&self.buf[usize::from(self.start)..]
}
/// Returns the ASCII representation of this decimal as a string slice.