diff options
| author | Knight <knight42@mail.ustc.edu.cn> | 2016-07-27 03:01:48 +0800 |
|---|---|---|
| committer | Knight <knight42@mail.ustc.edu.cn> | 2016-07-27 03:01:48 +0800 |
| commit | 14a7f4dedcdc25c2c1abf36addc52c8a48cdb7f9 (patch) | |
| tree | 408acd422b43006dd379f1cae431f0146928e1b7 | |
| parent | 9316ae515e2f8f3f497fb4f1559910c1eef2433d (diff) | |
| download | rust-14a7f4dedcdc25c2c1abf36addc52c8a48cdb7f9.tar.gz rust-14a7f4dedcdc25c2c1abf36addc52c8a48cdb7f9.zip | |
Fix #35031
| -rw-r--r-- | src/libcollections/fmt.rs | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/src/libcollections/fmt.rs b/src/libcollections/fmt.rs index c5312d0d9bb..be0ef85d6b1 100644 --- a/src/libcollections/fmt.rs +++ b/src/libcollections/fmt.rs @@ -434,37 +434,31 @@ //! in this case, if one uses the format string `{<arg>:<spec>.*}`, then the `<arg>` part refers //! to the *value* to print, and the `precision` must come in the input preceding `<arg>`. //! -//! For example, these: +//! For example, the following calls all print the same thing `Hello x is 0.01000`: //! //! ``` -//! // Hello {arg 0 (x)} is {arg 1 (0.01) with precision specified inline (5)} +//! // Hello {arg 0 ("x")} is {arg 1 (0.01) with precision specified inline (5)} //! println!("Hello {0} is {1:.5}", "x", 0.01); //! -//! // Hello {arg 1 (x)} is {arg 2 (0.01) with precision specified in arg 0 (5)} +//! // Hello {arg 1 ("x")} is {arg 2 (0.01) with precision specified in arg 0 (5)} //! println!("Hello {1} is {2:.0$}", 5, "x", 0.01); //! -//! // Hello {arg 0 (x)} is {arg 2 (0.01) with precision specified in arg 1 (5)} +//! // Hello {arg 0 ("x")} is {arg 2 (0.01) with precision specified in arg 1 (5)} //! println!("Hello {0} is {2:.1$}", "x", 5, 0.01); //! -//! // Hello {next arg (x)} is {second of next two args (0.01) with precision +//! // Hello {next arg ("x")} is {second of next two args (0.01) with precision //! // specified in first of next two args (5)} //! println!("Hello {} is {:.*}", "x", 5, 0.01); //! -//! // Hello {next arg (x)} is {arg 2 (0.01) with precision +//! // Hello {next arg ("x")} is {arg 2 (0.01) with precision //! // specified in its predecessor (5)} //! println!("Hello {} is {2:.*}", "x", 5, 0.01); //! -//! // Hello {next arg (x)} is {arg "number" (0.01) with precision specified +//! // Hello {next arg ("x")} is {arg "number" (0.01) with precision specified //! // in arg "prec" (5)} //! println!("Hello {} is {number:.prec$}", "x", prec = 5, number = 0.01); //! ``` //! -//! All print the same thing: -//! -//! ```text -//! Hello x is 0.01000 -//! ``` -//! //! While these: //! //! ``` |
