Open
Description
Given this source:
macro_rules! new_greeter {
() => {
#[template(
add = some::tokens,
to = make::the::line::longer
)]
struct X;
};
}
Call cargo fmt
(tested with +stable = 1.87.0
and +nightly = 1.89.0-nightly (056f5f4f3 2025-05-09)
).
The indentation level of add = ... )]
is incremented by 8 spaces for every fmt invocation until the 100 character line limit is hit.
Source after multiple `cargo fmt` calls (click me)
macro_rules! new_greeter {
() => {
#[template(
add = some::tokens,
to = make::the::line::longer
)]
struct X;
};
}
macro_rules! new_greeter {
() => {
#[template(
add = some::tokens,
to = make::the::line::longer
)]
struct X;
};
}
macro_rules! new_greeter {
() => {
#[template(
add = some::tokens,
to = make::the::line::longer
)]
struct X;
};
}
I would have assumed that cargo fmt
is idempotent, i.e. that calling after calling it once the code remains unchanged. (IHMO my example code does not need reformatting in any case.)
It can be tested on the playground, too:
- Open https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=5f02dcbdd46ac2b63a8c764aef618407
- Click tools / rustfmt.