Automatic fix for nonstandard_macro_braces fails
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 value
Original code:
https://github.com/hickory-dns/hickory-dns/blob/ec87f21341219d6be18f1cf1fe90ec2f0e975653/crates/resolver/src/hosts.rs#L246
With stable clippy from Rust 1.99.
I-suggestion-causes-bug is described as "suggestion compiles", but that's not the case here, FWIW.
ah thanks ^^
uhmmmm... I'm thinking of giving this a shot. Can I go ahead?
sure, that is why I marked it as a good first issue ^^
FYI, to communicate this to other contributors, you can @rustbot claim
Alright.. Thank you!
@rustbot claim
@rustbot claim