We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3420c88 commit 6786f22Copy full SHA for 6786f22
coretests/tests/fmt/mod.rs
@@ -2,6 +2,21 @@ mod builders;
2
mod float;
3
mod num;
4
5
+#[test]
6
+fn test_lifetime() {
7
+ // Trigger all different forms of expansion,
8
+ // and check that each of them can be stored as a variable.
9
+ let a = format_args!("hello");
10
+ let a = format_args!("hello {a}");
11
+ let a = format_args!("hello {a:1}");
12
+ let a = format_args!("hello {a} {a:?}");
13
+ assert_eq!(a.to_string(), "hello hello hello hello hello hello hello");
14
+
15
+ // Without arguments, it should also work in consts.
16
+ const A: std::fmt::Arguments<'static> = format_args!("hello");
17
+ assert_eq!(A.to_string(), "hello");
18
+}
19
20
#[test]
21
fn test_format_flags() {
22
// No residual flags left by pointer formatting
0 commit comments