about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2016-06-28 16:05:15 +0200
committerGitHub <noreply@github.com>2016-06-28 16:05:15 +0200
commitb765edf440ae7ecb8a5026d101767a331012f1e9 (patch)
treeb8c6a550c550938e3c5a405ebb7af76ddd6657fc
parent86e4a034af977cb3525e1b23933faccda6b138ca (diff)
parent6418cb47d4ea58ad3bba87939efb64af1cc1e194 (diff)
downloadrust-b765edf440ae7ecb8a5026d101767a331012f1e9.tar.gz
rust-b765edf440ae7ecb8a5026d101767a331012f1e9.zip
Rollup merge of #34462 - dns2utf8:leading_zeros, r=GuillaumeGomez
Add example with leading zeros

I was searching for this format very long. So I added an example to the prominent section.

I was thinking of putting the keyword leading in the corresponding section as well, what do you think?

r? @steveklabnik
-rw-r--r--src/libcollections/fmt.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/libcollections/fmt.rs b/src/libcollections/fmt.rs
index 6f77d79ab0b..15de0dd802d 100644
--- a/src/libcollections/fmt.rs
+++ b/src/libcollections/fmt.rs
@@ -28,6 +28,7 @@
 //! format!("{:?}", (3, 4));          // => "(3, 4)"
 //! format!("{value}", value=4);      // => "4"
 //! format!("{} {}", 1, 2);           // => "1 2"
+//! format!("{:04}", 42);             // => "0042" with leading zeros
 //! ```
 //!
 //! From these, you can see that the first argument is a format string. It is