@@ -88,15 +88,19 @@ macro_rules! vec {
8888///
8989/// A common use for `format!` is concatenation and interpolation of strings.
9090/// 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!`] .
9292///
9393/// To convert a single value to a string, use the [`to_string`] method. This
9494/// will use the [`Display`] formatting trait.
9595///
96+ /// To concatenate literals into a `&'static str`, use the [`concat!`] macro.
97+ ///
9698/// [`print!`]: ../std/macro.print.html
9799/// [`write!`]: core::write
100+ /// [`format_args!`]: core::format_args
98101/// [`to_string`]: crate::string::ToString
99102/// [`Display`]: core::fmt::Display
103+ /// [`concat!`]: core::concat
100104///
101105/// # Panics
102106///
@@ -107,11 +111,11 @@ macro_rules! vec {
107111/// # Examples
108112///
109113/// ```
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"
113117/// let (x, y) = (1, 2);
114- /// format!("{x} + {y} = 3");
118+ /// format!("{x} + {y} = 3"); // => "1 + 2 = 3"
115119/// ```
116120#[ macro_export]
117121#[ stable( feature = "rust1" , since = "1.0.0" ) ]
0 commit comments