Skip to content

Commit 93a3e93

Browse files
authored
tweak fmt::Arguments docs
Remove an outdated claim about passing something or other to a function. Also swap the variable names in the example.
1 parent b12af86 commit 93a3e93

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/libcore/fmt/mod.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -401,19 +401,18 @@ impl<'a> Arguments<'a> {
401401
/// safely be done, so no constructors are given and the fields are private
402402
/// to prevent modification.
403403
///
404-
/// The [`format_args!`] macro will safely create an instance of this structure
405-
/// and pass it to a function or closure, passed as the first argument. The
406-
/// macro validates the format string at compile-time so usage of the [`write`]
407-
/// and [`format`] functions can be safely performed.
404+
/// The [`format_args!`] macro will safely create an instance of this structure.
405+
/// The macro validates the format string at compile-time so usage of the
406+
/// [`write`] and [`format`] functions can be safely performed.
408407
///
409408
/// You can use the `Arguments<'a>` that [`format_args!`] returns in `Debug`
410409
/// and `Display` contexts as seen below. The example also shows that `Debug`
411410
/// and `Display` format to the same thing: the interpolated format string
412411
/// in `format_args!`.
413412
///
414413
/// ```rust
415-
/// let display = format!("{:?}", format_args!("{} foo {:?}", 1, 2));
416-
/// let debug = format!("{}", format_args!("{} foo {:?}", 1, 2));
414+
/// let debug = format!("{:?}", format_args!("{} foo {:?}", 1, 2));
415+
/// let display = format!("{}", format_args!("{} foo {:?}", 1, 2));
417416
/// assert_eq!("1 foo 2", display);
418417
/// assert_eq!(display, debug);
419418
/// ```

0 commit comments

Comments
 (0)