1
Fork 0

Rollup merge of #40048 - jimblandy:fmt-arg-types-doc, r=alexcrichton

Update std::fmt module docs for landing of #33642.

Since #33642, it's no longer true that all references to a given format argument must use the same type. The docs don't seem to have been updated.
This commit is contained in:
Guillaume Gomez 2017-02-24 13:22:58 +01:00 committed by GitHub
commit 173b725b89

View file

@ -62,7 +62,7 @@
//! //!
//! A format string is required to use all of its arguments, otherwise it is a //! A format string is required to use all of its arguments, otherwise it is a
//! compile-time error. You may refer to the same argument more than once in the //! compile-time error. You may refer to the same argument more than once in the
//! format string, although it must always be referred to with the same type. //! format string.
//! //!
//! ## Named parameters //! ## Named parameters
//! //!
@ -89,19 +89,8 @@
//! //!
//! ## Argument types //! ## Argument types
//! //!
//! Each argument's type is dictated by the format string. It is a requirement //! Each argument's type is dictated by the format string.
//! that every argument is only ever referred to by one type. For example, this //! There are various parameters which require a particular type, however.
//! is an invalid format string:
//!
//! ```text
//! {0:x} {0:o}
//! ```
//!
//! This is invalid because the first argument is both referred to as a
//! hexadecimal as well as an
//! octal.
//!
//! There are various parameters which do require a particular type, however.
//! An example is the `{:.*}` syntax, which sets the number of decimal places //! An example is the `{:.*}` syntax, which sets the number of decimal places
//! in floating-point types: //! in floating-point types:
//! //!
@ -113,13 +102,7 @@
//! //!
//! If this syntax is used, then the number of characters to print precedes the //! If this syntax is used, then the number of characters to print precedes the
//! actual object being formatted, and the number of characters must have the //! actual object being formatted, and the number of characters must have the
//! type `usize`. Although a `usize` can be printed with `{}`, it is invalid to //! type `usize`.
//! reference an argument as such. For example this is another invalid format
//! string:
//!
//! ```text
//! {:.*} {0}
//! ```
//! //!
//! ## Formatting traits //! ## Formatting traits
//! //!