Skip to content

std::fmt module documentation error #22646

Closed
@leonardinius

Description

@leonardinius

See http://doc.rust-lang.org/std/fmt/index.html

e.g. http://doc.rust-lang.org/src/collections/fmt.rs.html#365-369

'0' - This is used to indicate for integer formats that the padding should both be done with a 0 character as well as be sign-aware. A format like {:08d} would yield 00000001 for the integer 1, while the same format would yield -0000001 for the integer -1. Notice that the negative version has one fewer zero than the positive version.

It seems what instead of {:08d}, {:08} is required.

E.g. (http://is.gd/oL48zO)

fn main() {
    println!("{:08d}", 10i32); 
}

produces

<anon>:2:24: 2:29 error: unknown format trait `d`
<anon>:2     println!("{:08d}", 10i32); 
                                ^~~~~

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions