- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
Open
Labels
A-fmtArea: `core::fmt`Area: `core::fmt`C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Description
Feature gate: #![feature(simple_fmt)]
This is a tracking issue for the simple_fmt method on the Display format trait.
Public API
  pub trait Display {
      fn fmt(&self, f: &mut Formatter) -> Result;
+     fn simple_fmt(&self, f: &mut Formatter) -> Result {
+         self.fmt(f)
+     }
  }Formatting placeholders without any options, like in format_args!("{}", x), will call the simple_fmt method rather than fmt. This allows for optimized implementations for e.g. <String as Display>::simple_fmt that do not need to pull in code for padding, etc. See #104525 (comment).
Steps / History
- Implementation: Optimize format_args placeholders without options: Display::simple_fmt #104525
- Final comment period (FCP)
- Stabilization PR
Unresolved Questions
-  Do we want this on the other formatting traits too? Or only Display?
-  Do we want to stabilize this at all, to allow crates to override simple_fmtfor their own types?
-  Should the method be unsafe, such that the implementation may unsafely assume that theFormatter's options are all set to default?
Metadata
Metadata
Assignees
Labels
A-fmtArea: `core::fmt`Area: `core::fmt`C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.