You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enable nonstandard_macro_braces and enforce [] for children! (#17974)
# Objective
-
[`nonstandard_macro_braces`](https://rust-lang.github.io/rust-clippy/master/index.html#nonstandard_macro_braces)
is a Clippy lint that enforces what braces certain known macros are
allowed to use.
- For instance, requiring `println!()` instead of `println!{}`.
- I started working on this after seeing
TheBevyFlock/bevy_cli#277.
## Solution
- Enable `nonstandard_macro_braces` in the workspace.
- Configure Clippy so it enforces `[]` braces for `children!`.
## Testing
1. Create `examples/clippy_test.rs`.
2. Paste the following code:
```rust
//! Some docs woooooooo
use bevy::prelude::*;
fn main() {
let _ = children!(Name::new("Foo"));
}
```
3. Run `cargo clippy --example clippy_test`.
4. Ensure the following warning is emitted:
```sh
warning: use of irregular braces for `children!` macro
--> examples/clippy_test.rs:6:13
|
6 | let _ = children!(Name::new("Foo"));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `children![Name::new("Foo")]`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonstandard_macro_braces
= note: requested on the command line with `-W clippy::nonstandard-macro-braces`
warning: `bevy` (example "clippy_test") generated 1 warning (run `cargo clippy --fix --example "clippy_test"` to apply 1 suggestion)
```
0 commit comments