Get rid of core::fmt::FormatSpec.
This commit is contained in:
parent
938efe6f49
commit
bca80d811c
2 changed files with 6 additions and 11 deletions
|
@ -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
|
||||
|
|
|
@ -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 @@ impl Placeholder {
|
|||
precision: Count,
|
||||
width: Count,
|
||||
) -> Self {
|
||||
Self { position, format: FormatSpec { fill, align, flags, precision, width } }
|
||||
Self { position, fill, align, flags, precision, width }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue