-
Notifications
You must be signed in to change notification settings - Fork 973
Open
Labels
A-macrosArea: macros (procedural macros, macro_rules! macros, etc.)Area: macros (procedural macros, macro_rules! macros, etc.)C-bugCategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICECategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICE
Description
macro_rules! generate_the_struct {
($a:literal) => {
pub struct Struct {
#[clap(
long = "--alpha-beta-gamma",
env = "ALPHA_BETA_GAMMA",
default_value = $a,
)]
alpha_beta_gamma: usize,
}
};
}The arguments of the clap attribute will be indented for every call to cargo fmt. For example...
% for x in $(seq 10); do cargo fmt; done
% git diff
diff --git a/src/main.rs b/src/main.rs
index 1f1a25c..c1dee62 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -2,10 +2,10 @@ macro_rules! generate_the_struct {
($a:literal) => {
pub struct Struct {
#[clap(
- long = "--alpha-beta-gamma",
- env = "ALPHA_BETA_GAMMA",
- default_value = $a,
- )]
+ long = "--alpha-beta-gamma",
+ env = "ALPHA_BETA_GAMMA",
+ default_value = $a,
+ )]
alpha_beta_gamma: usize,
}
};This occurs with:
rustfmt 1.4.38-stable (e092d0b6 2022-07-16)rustfmt 1.5.1-nightly (f6f9d5e7 2022-08-04)
Kijewski
Metadata
Metadata
Assignees
Labels
A-macrosArea: macros (procedural macros, macro_rules! macros, etc.)Area: macros (procedural macros, macro_rules! macros, etc.)C-bugCategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICECategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICE