Automatic fix for nonstandard_macro_braces fails
Author: djcCreated Oct 1, 2026Updated Oct 1, 2026
LabelsC-buggood first issueL-suggestionI-suggestion-causes-error
Summary
For this issue:
warning: use of irregular braces for `format!` macro
--> crates/resolver/src/hosts.rs:246:9
|
246 | format! {"{server_path}/crates/resolver/tests"}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `format!("{server_path}/crates/resolver/tests");`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.99.0/index.html#nonstandard_macro_braces
= note: `#[warn(clippy::nonstandard_macro_braces)]` on by default--fix produced this diff:
diff --git a/crates/resolver/src/hosts.rs b/crates/resolver/src/hosts.rs
index b314f4665..92ce94c0d 100644
--- a/crates/resolver/src/hosts.rs
+++ b/crates/resolver/src/hosts.rs
@@ -243,7 +243,7 @@ mod tests {
fn tests_dir() -> String {
let server_path = env::var("TDNS_WORKSPACE_ROOT").unwrap_or_else(|_| "../..".to_owned());
- format! {"{server_path}/crates/resolver/tests"}
+ format!("{server_path}/crates/resolver/tests");
}
resulting in this compilation failure:
error[E0308]: mismatched types
--> crates/resolver/src/hosts.rs:244:23
|
244 | fn tests_dir() -> String {
| --------- ^^^^^^ expected `String`, found `()`
| |
| implicitly returns `()` as its body has no tail or `return` expression
245 | let server_path = env::var("TDNS_WORKSPACE_R...
246 | format!("{server_path}/crates/resolver/tests");
| - help: remove this semicolon to return this valueOriginal code:
With stable clippy from Rust 1.99.
Source: rust-lang/rust-clippy