Skip to content

Consider checking for formattee errors in ToString::to_string and format!() #40103

Description

@nox

In both ToString for T: Display and format!(), it is assumed that no Display implementation will ever return Err(_) because none of the methods of Write for String do.

Given the Display trait does not document that it should not fail on its own, I think both ToString for T: Display types and format!() should unwrap the calls to Write::write_fmt instead of completely ignoring their result.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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