Repository navigation
Automatic fix for nonstandard_macro_braces fails #17830
Copy link
Copy link
Open
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-suggestion-causes-errorIssue: The suggestions provided by this Lint cause an ICE/error when appliedIssue: The suggestions provided by this Lint cause an ICE/error when appliedL-suggestionLint: Improving, adding or fixing lint suggestionsLint: Improving, adding or fixing lint suggestionsgood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy
Description
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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-suggestion-causes-errorIssue: The suggestions provided by this Lint cause an ICE/error when appliedIssue: The suggestions provided by this Lint cause an ICE/error when appliedL-suggestionLint: Improving, adding or fixing lint suggestionsLint: Improving, adding or fixing lint suggestionsgood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy
Activity
djc commentedon Oct 1, 2026
I-suggestion-causes-bugis described as "suggestion compiles", but that's not the case here, FWIW.CommanderStorm commentedon Oct 1, 2026
ah thanks ^^
codediebere commentedon Oct 1, 2026
uhmmmm... I'm thinking of giving this a shot.
Can I go ahead?
CommanderStorm commentedon Oct 1, 2026
sure, that is why I marked it as a
good first issue^^FYI, to communicate this to other contributors, you can
@rustbot claimcodediebere commentedon Oct 1, 2026
Alright.. Thank you!
codediebere commentedon Oct 1, 2026
@rustbot claim
jny0444 commentedon Oct 14, 2026
@rustbot claim