Skip to content

Commit afd80a2

Browse files
committed
std::fmt: Added argument index comments to examples for specifying precision
The examples for specifying the precision have comments explaining which argument the specifier is referring to. However, for implicit positional arguments, the examples simply talk about "next arg". To make it easier for readers to follow the comments, "next arg" was supplemented with the actual resulting argument index.
1 parent 1288883 commit afd80a2

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

library/alloc/src/fmt.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -240,19 +240,19 @@
240240
//! // Hello {arg 0 ("x")} is {arg 2 (0.01) with precision specified in arg 1 (5)}
241241
//! println!("Hello {0} is {2:.1$}", "x", 5, 0.01);
242242
//!
243-
//! // Hello {next arg ("x")} is {second of next two args (0.01) with precision
244-
//! // specified in first of next two args (5)}
243+
//! // Hello {next arg -> arg 0 ("x")} is {second of next two args -> arg 2 (0.01) with precision
244+
//! // specified in first of next two args -> arg 1 (5)}
245245
//! println!("Hello {} is {:.*}", "x", 5, 0.01);
246246
//!
247247
//! // Hello {arg 1 ("x")} is {arg 2 (0.01) with precision
248-
//! // specified in next arg (5)}
248+
//! // specified in next arg -> arg 0 (5)}
249249
//! println!("Hello {1} is {2:.*}", 5, "x", 0.01);
250250
//!
251-
//! // Hello {next arg ("x")} is {arg 2 (0.01) with precision
252-
//! // specified in next arg (5)}
251+
//! // Hello {next arg -> arg 0 ("x")} is {arg 2 (0.01) with precision
252+
//! // specified in next arg -> arg 1 (5)}
253253
//! println!("Hello {} is {2:.*}", "x", 5, 0.01);
254254
//!
255-
//! // Hello {next arg ("x")} is {arg "number" (0.01) with precision specified
255+
//! // Hello {next arg -> arg 0 ("x")} is {arg "number" (0.01) with precision specified
256256
//! // in arg "prec" (5)}
257257
//! println!("Hello {} is {number:.prec$}", "x", prec = 5, number = 0.01);
258258
//! ```

0 commit comments

Comments
 (0)