@@ -88,15 +88,19 @@ macro_rules! vec {
88
88
///
89
89
/// A common use for `format!` is concatenation and interpolation of strings.
90
90
/// The same convention is used with [`print!`] and [`write!`] macros,
91
- /// depending on the intended destination of the string.
91
+ /// depending on the intended destination of the string; all these macros internally use [`format_args!`] .
92
92
///
93
93
/// To convert a single value to a string, use the [`to_string`] method. This
94
94
/// will use the [`Display`] formatting trait.
95
95
///
96
+ /// To concatenate literals into a `&'static str`, use the [`concat!`] macro.
97
+ ///
96
98
/// [`print!`]: ../std/macro.print.html
97
99
/// [`write!`]: core::write
100
+ /// [`format_args!`]: core::format_args
98
101
/// [`to_string`]: crate::string::ToString
99
102
/// [`Display`]: core::fmt::Display
103
+ /// [`concat!`]: core::concat
100
104
///
101
105
/// # Panics
102
106
///
@@ -107,11 +111,11 @@ macro_rules! vec {
107
111
/// # Examples
108
112
///
109
113
/// ```
110
- /// format!("test");
111
- /// format!("hello {}", "world!");
112
- /// format!("x = {}, y = {y }", 10, y = 30);
114
+ /// format!("test"); // => "test"
115
+ /// format!("hello {}", "world!"); // => "hello world!"
116
+ /// format!("x = {}, y = {val }", 10, val = 30); // => "x = 10, y = 30"
113
117
/// let (x, y) = (1, 2);
114
- /// format!("{x} + {y} = 3");
118
+ /// format!("{x} + {y} = 3"); // => "1 + 2 = 3"
115
119
/// ```
116
120
#[ macro_export]
117
121
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
0 commit comments