-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-negativeIssue: The lint should have been triggered on code, but wasn'tIssue: The lint should have been triggered on code, but wasn't
Description
Summary
see the reproducer
Lint Name
nonstandard_macro_braces
Reproducer
I tried this code:
fn main() {
println!();
println!("");
println![];
println![""];
println!{}
println!{""}
println!{};
println!{""};
}
I expected to see this happen:
fn main() {
println!();
println!("");
println![]; // lint
println![""]; // lint
println!{} // lint
println!{""} // lint
println!{}; // lint
println!{""}; // lint
}
Instead, this happened:
fn main() {
println!();
println!("");
println![]; // lint
println![""]; // no lint
println!{} // lint
println!{""} // no lint
println!{}; // lint
println!{""}; // no lint
}
I thought this might have something to do with the way the macro gets expanded, but there doesn't seem to be an obvious correlation:
fn main() {
{ ::std::io::_print(format_args!("\n")); };
{ ::std::io::_print(format_args!("\n")); };
{ ::std::io::_print(format_args!("\n")); }; // lint
{ ::std::io::_print(format_args!("\n")); }; // no lint
{ ::std::io::_print(format_args!("\n")); } // lint
{ ::std::io::_print(format_args!("\n")); } // no lint
{ ::std::io::_print(format_args!("\n")); }; // lint
{ ::std::io::_print(format_args!("\n")); }; // no lint
}
Version
Rust playground:
- stable 1.89.0
- nightly 2025-08-29
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-negativeIssue: The lint should have been triggered on code, but wasn'tIssue: The lint should have been triggered on code, but wasn't