From acca4b8f86b1cf7b41236225247b884f6a52d708 Mon Sep 17 00:00:00 2001 From: Isaac Cloos Date: Sun, 21 Aug 2022 15:28:27 -0400 Subject: [PATCH] Extra documentation for new formatting feature High traffic macros should detail this helpful addition. --- library/alloc/src/macros.rs | 2 ++ library/std/src/macros.rs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/library/alloc/src/macros.rs b/library/alloc/src/macros.rs index 88eb6aa7a83c1..5198bf297d925 100644 --- a/library/alloc/src/macros.rs +++ b/library/alloc/src/macros.rs @@ -107,6 +107,8 @@ macro_rules! vec { /// format!("test"); /// format!("hello {}", "world!"); /// format!("x = {}, y = {y}", 10, y = 30); +/// let (x, y) = (1, 2); +/// format!("{x} + {y} = 3"); /// ``` #[macro_export] #[stable(feature = "rust1", since = "1.0.0")] diff --git a/library/std/src/macros.rs b/library/std/src/macros.rs index 0cb21ef53b1eb..ce2a979475c9c 100644 --- a/library/std/src/macros.rs +++ b/library/std/src/macros.rs @@ -93,6 +93,8 @@ macro_rules! print { /// println!(); // prints just a newline /// println!("hello there!"); /// println!("format {} arguments", "some"); +/// let local_variable = "some"; +/// println!("format {local_variable} arguments"); /// ``` #[macro_export] #[stable(feature = "rust1", since = "1.0.0")]