Skip to content

Commit 3b432d2

Browse files
steveklabnikManishearth
authored andcommitted
---
yaml --- r: 191847 b: refs/heads/snap-stage3 c: 8a8b2ce h: refs/heads/master i: 191845: 2d45153 191843: 42c63d9 191839: 64f62a7 v: v3
1 parent 1b552fe commit 3b432d2

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 809a554fca2d0ebc2ba50077016fe282a4064752
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 351721cde6534d0a20bda8cbacc0019fca6caf3f
4+
refs/heads/snap-stage3: 8a8b2cecbc1fab7ffa4a20efb6dc4deed876571e
55
refs/heads/try: ce76bff75603a754d092456285ff455eb871633d
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/src/libcollections/fmt.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,18 @@
105105
//! hexadecimal as well as an
106106
//! octal.
107107
//!
108-
//! There are various parameters which do require a particular type, however.
109-
//! Namely if the syntax `{:.*}` is used, then the number of characters to print
110-
//! precedes the actual object being formatted, and the number of characters
111-
//! must have the type `usize`. Although a `usize` can be printed with `{}`, it is
112-
//! illegal to reference an argument as such. For example this is another
108+
//! There are various parameters which do require a particular type, however. Namely, the `{:.*}`
109+
//! syntax, which sets the number of numbers after the decimal in floating-point types:
110+
//!
111+
//! ```
112+
//! let formatted_number = format!("{:.*}", 2, 1.234567);
113+
//!
114+
//! assert_eq!("1.23", formatted_number)
115+
//! ```
116+
//!
117+
//! If this syntax is used, then the number of characters to print precedes the actual object being
118+
//! formatted, and the number of characters must have the type `usize`. Although a `usize` can be
119+
//! printed with `{}`, it is illegal to reference an argument as such. For example this is another
113120
//! invalid format string:
114121
//!
115122
//! ```text

0 commit comments

Comments
 (0)