Formatting width is not always respected?

Here's a stripped down version of the problem I'm experiencing: Rust Playground

Is there a way to make the first work like the second?

Thanks!

The easiest way would be to delegate:

    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        "x".fmt(f)
    }

But you can also make use of the methods on Formatter directly, if needed.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.