tidy: allow direct format args capture in macro

This commit is contained in:
est31 2023-03-04 04:24:09 +01:00
parent 67e1681c1d
commit cde0b164d2

View File

@ -171,9 +171,9 @@ fn contains_ignore_directive(can_contain: bool, contents: &str, check: &str) ->
}
macro_rules! suppressible_tidy_err {
($err:ident, $skip:ident, $msg:expr) => {
($err:ident, $skip:ident, $msg:literal) => {
if let Directive::Deny = $skip {
$err($msg);
$err(&format!($msg));
} else {
$skip = Directive::Ignore(true);
}
@ -351,7 +351,7 @@ pub fn check(path: &Path, bad: &mut bool) {
suppressible_tidy_err!(
err,
skip_line_length,
&format!("line longer than {max_columns} chars")
"line longer than {max_columns} chars"
);
}
if !is_style_file && line.contains('\t') {
@ -441,7 +441,7 @@ pub fn check(path: &Path, bad: &mut bool) {
n => suppressible_tidy_err!(
err,
skip_trailing_newlines,
&format!("too many trailing newlines ({n})")
"too many trailing newlines ({n})"
),
};
if lines > LINES {