Sorry for the bad title. I'm trying to make a macro that prints strings and optionally moves the cursor to a location before printing the string.
#[macro_export()]
macro_rules! put {
($($arg:tt)+) => {
print!($($arg)*);
};
($x:tt, $y:tt, $($arg:tt)+) => {
minicurses::mv($x, $y); // function that moves the cursor
print!($($arg)*);
}
}
This doesn't work, as whenever i try to use the macro with the numbers, it thinks I'm trying to format it with a string literal. Output from cargo clippy:
Checking testing v0.1.0 (directory)
error: format argument must be a string literal
--> src/main.rs:4:10
|
4 | put!(1, 1, "hello");
| ^
|
help: you might be missing a string literal to format with
|
4 | put!("{} {} {}", 1, 1, "hello");
| +++++++++++
How would i fix this?