From bca80d811c44998e99014c4f85c1130c26cd9dd3 Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Thu, 20 Apr 2023 18:07:34 +0200 Subject: [PATCH] Get rid of core::fmt::FormatSpec. --- library/core/src/fmt/mod.rs | 10 +++++----- library/core/src/fmt/rt.rs | 7 +------ 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/library/core/src/fmt/mod.rs b/library/core/src/fmt/mod.rs index bbbfe06656c..de958a82d96 100644 --- a/library/core/src/fmt/mod.rs +++ b/library/core/src/fmt/mod.rs @@ -1277,14 +1277,14 @@ pub fn write(output: &mut dyn Write, args: Arguments<'_>) -> Result { } unsafe fn run(fmt: &mut Formatter<'_>, arg: &rt::Placeholder, args: &[ArgumentV1<'_>]) -> Result { - fmt.fill = arg.format.fill; - fmt.align = arg.format.align; - fmt.flags = arg.format.flags; + fmt.fill = arg.fill; + fmt.align = arg.align; + fmt.flags = arg.flags; // SAFETY: arg and args come from the same Arguments, // which guarantees the indexes are always within bounds. unsafe { - fmt.width = getcount(args, &arg.format.width); - fmt.precision = getcount(args, &arg.format.precision); + fmt.width = getcount(args, &arg.width); + fmt.precision = getcount(args, &arg.precision); } // Extract the correct argument diff --git a/library/core/src/fmt/rt.rs b/library/core/src/fmt/rt.rs index 497b2e27739..a431ee54d95 100644 --- a/library/core/src/fmt/rt.rs +++ b/library/core/src/fmt/rt.rs @@ -7,11 +7,6 @@ #[derive(Copy, Clone)] pub struct Placeholder { pub position: usize, - pub format: FormatSpec, -} - -#[derive(Copy, Clone)] -pub struct FormatSpec { pub fill: char, pub align: Alignment, pub flags: u32, @@ -29,7 +24,7 @@ pub const fn new( precision: Count, width: Count, ) -> Self { - Self { position, format: FormatSpec { fill, align, flags, precision, width } } + Self { position, fill, align, flags, precision, width } } }