diff options
| author | Isaac Cloos <cloosisaac@gmail.com> | 2022-08-21 15:28:27 -0400 |
|---|---|---|
| committer | Isaac Cloos <cloosisaac@gmail.com> | 2022-08-21 15:28:27 -0400 |
| commit | acca4b8f86b1cf7b41236225247b884f6a52d708 (patch) | |
| tree | b2ace9214a1f7bf6b74535869bcba99efdbf0f67 | |
| parent | 650bff80a623e17675ac72ae4d62ed200a4a3568 (diff) | |
| download | rust-acca4b8f86b1cf7b41236225247b884f6a52d708.tar.gz rust-acca4b8f86b1cf7b41236225247b884f6a52d708.zip | |
Extra documentation for new formatting feature
High traffic macros should detail this helpful addition.
| -rw-r--r-- | library/alloc/src/macros.rs | 2 | ||||
| -rw-r--r-- | library/std/src/macros.rs | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/library/alloc/src/macros.rs b/library/alloc/src/macros.rs index 88eb6aa7a83..5198bf297d9 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 0cb21ef53b1..ce2a979475c 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")] |
