-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Tracking Issue for simple_fmt #105054
Copy link
Copy link
Closed as not planned
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.
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.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Feature gate:
#![feature(simple_fmt)]This is a tracking issue for the
simple_fmtmethod on theDisplayformat 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 thesimple_fmtmethod rather thanfmt. This allows for optimized implementations for e.g.<String as Display>::simple_fmtthat do not need to pull in code for padding, etc. See #104525 (comment).Steps / History
Unresolved Questions
Display?simple_fmtfor their own types?unsafe, such that the implementation may unsafely assume that theFormatter's options are all set to default?