rustfmt
rustfmt copied to clipboard
Feature request: Add an option to place the arguments of function-like attributes on the same line until `attr_fn_like_width` is exceeded.
When there are many arguments in the #[derive(...)] attribute, placing one argument per line makes the code vertically long and difficult to read.
Could you consider adding an option to place the arguments on the same line until the attr_fn_like_width is exceeded, as shown in the example below?
Example
Current behaviour (rustfmt 1.7.0-stable (3f5fd8d 2024-08-06)):
use derive_more::{
Add, AddAssign, AsMut, AsRef, Deref, DerefMut, Div, DivAssign, From, Into, Mul, MulAssign, Neg,
Rem, RemAssign, Sub, SubAssign,
};
#[repr(transparent)]
#[derive(
Copy,
Clone,
Debug,
PartialEq,
PartialOrd,
Deref,
DerefMut,
Neg,
Add,
AddAssign,
Sub,
SubAssign,
Mul,
MulAssign,
Div,
DivAssign,
Rem,
RemAssign,
From,
Into,
AsRef,
AsMut,
)]
pub struct Meters(pub f32);
fn main() {}
Expected behaviour (when attr_fn_like_width=70):
use derive_more::{
Add, AddAssign, AsMut, AsRef, Deref, DerefMut, Div, DivAssign, From, Into, Mul, MulAssign, Neg,
Rem, RemAssign, Sub, SubAssign,
};
#[repr(transparent)]
#[derive(
Copy, Clone, Debug, PartialEq, PartialOrd, Deref, DerefMut, Neg,
Add, AddAssign, Sub, SubAssign, Mul, MulAssign, Div, DivAssign,
Rem, RemAssign, From, Into, AsRef, AsMut,
)]
pub struct Meters(pub f32);
fn main() {}