RS.CLIPPY.NONSTANDARD_MACRO_BRACES

Check consistent use of braces in macro

This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: nonstandard_macro_braces. Copyright ©2025 The Rust Team. All rights reserved.

What it does

Checks that common macros are used with consistent bracing.

Why is this bad?

This is mostly a consistency lint although using () or [] doesn't give you a semicolon in item position, which can be unexpected.

Example

vec!{1, 2, 3};

Use instead:

vec![1, 2, 3];

Configuration

  • standard-macro-braces: Enforce the named macros always use the braces specified.

A MacroMatcher can be added like so { name = "macro_name", brace = "(" }. If the macro could be used with a full path two MacroMatchers have to be added one with the full path crate_name::macro_name and one with just the macro name.

(default: [])