Skip to content

Commit feb7e4a

Browse files
committed
Rollup merge of rust-lang#49619 - durka:patch-46, r=steveklabnik
tweak core::fmt docs Remove an outdated (pre-1.0!) claim about passing something or other to a function. Also swap the variable names in the example.
2 parents 572fabd + 333b0a0 commit feb7e4a

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
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
/// ```

src/libstd/macros.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,8 @@ pub mod builtin {
341341
/// format string in `format_args!`.
342342
///
343343
/// ```rust
344-
/// let display = format!("{:?}", format_args!("{} foo {:?}", 1, 2));
345-
/// let debug = format!("{}", format_args!("{} foo {:?}", 1, 2));
344+
/// let debug = format!("{:?}", format_args!("{} foo {:?}", 1, 2));
345+
/// let display = format!("{}", format_args!("{} foo {:?}", 1, 2));
346346
/// assert_eq!("1 foo 2", display);
347347
/// assert_eq!(display, debug);
348348
/// ```

0 commit comments

Comments
 (0)