1
Fork 0

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