Skip to content

Commit fa620d0

Browse files
committed
more macro tests
1 parent 6685596 commit fa620d0

File tree

3 files changed

+99
-71
lines changed

3 files changed

+99
-71
lines changed

tests/ui/uninlined_format_args.fixed

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,18 @@ macro_rules! pass_through {
2020
};
2121
}
2222

23+
macro_rules! my_println {
24+
($($args:tt),*) => {{
25+
println!($($args),*)
26+
}};
27+
}
28+
29+
macro_rules! my_println_args {
30+
($($args:tt),*) => {{
31+
println!("foo: {}", format_args!($($args),*))
32+
}};
33+
}
34+
2335
fn tester(fn_arg: i32) {
2436
let local_i32 = 1;
2537
let local_f64 = 2.0;
@@ -115,6 +127,8 @@ fn tester(fn_arg: i32) {
115127
println!("{local_i32:width$.prec$}");
116128
println!("{width:width$.prec$}");
117129
println!("{}", format!("{local_i32}"));
130+
my_println!("{}", local_i32);
131+
my_println_args!("{}", local_i32);
118132

119133
// these should NOT be modified by the lint
120134
println!(concat!("nope ", "{}"), local_i32);

tests/ui/uninlined_format_args.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,18 @@ macro_rules! pass_through {
2020
};
2121
}
2222

23+
macro_rules! my_println {
24+
($($args:tt),*) => {{
25+
println!($($args),*)
26+
}};
27+
}
28+
29+
macro_rules! my_println_args {
30+
($($args:tt),*) => {{
31+
println!("foo: {}", format_args!($($args),*))
32+
}};
33+
}
34+
2335
fn tester(fn_arg: i32) {
2436
let local_i32 = 1;
2537
let local_f64 = 2.0;
@@ -118,6 +130,8 @@ fn tester(fn_arg: i32) {
118130
println!("{:w$.p$}", local_i32, w = width, p = prec);
119131
println!("{:w$.p$}", w = width, p = prec);
120132
println!("{}", format!("{}", local_i32));
133+
my_println!("{}", local_i32);
134+
my_println_args!("{}", local_i32);
121135

122136
// these should NOT be modified by the lint
123137
println!(concat!("nope ", "{}"), local_i32);

0 commit comments

Comments
 (0)