File tree 1 file changed +4
-21
lines changed
1 file changed +4
-21
lines changed Original file line number Diff line number Diff line change 62
62
//!
63
63
//! A format string is required to use all of its arguments, otherwise it is a
64
64
//! compile-time error. You may refer to the same argument more than once in the
65
- //! format string, although it must always be referred to with the same type .
65
+ //! format string.
66
66
//!
67
67
//! ## Named parameters
68
68
//!
89
89
//!
90
90
//! ## Argument types
91
91
//!
92
- //! Each argument's type is dictated by the format string. It is a requirement
93
- //! that every argument is only ever referred to by one type. For example, this
94
- //! is an invalid format string:
95
- //!
96
- //! ```text
97
- //! {0:x} {0:o}
98
- //! ```
99
- //!
100
- //! This is invalid because the first argument is both referred to as a
101
- //! hexadecimal as well as an
102
- //! octal.
103
- //!
104
- //! There are various parameters which do require a particular type, however.
92
+ //! Each argument's type is dictated by the format string.
93
+ //! There are various parameters which require a particular type, however.
105
94
//! An example is the `{:.*}` syntax, which sets the number of decimal places
106
95
//! in floating-point types:
107
96
//!
113
102
//!
114
103
//! If this syntax is used, then the number of characters to print precedes the
115
104
//! actual object being formatted, and the number of characters must have the
116
- //! type `usize`. Although a `usize` can be printed with `{}`, it is invalid to
117
- //! reference an argument as such. For example this is another invalid format
118
- //! string:
119
- //!
120
- //! ```text
121
- //! {:.*} {0}
122
- //! ```
105
+ //! type `usize`.
123
106
//!
124
107
//! ## Formatting traits
125
108
//!
You can’t perform that action at this time.
0 commit comments