Open
Description
Some people like to align match arms for readability
match val {
&TOMLValue::Integer(_) => ArrayType::Integer,
&TOMLValue::Float(_) => ArrayType::Float,
&TOMLValue::Boolean(_) => ArrayType::Boolean,
&TOMLValue::DateTime(_) => ArrayType::DateTime,
&TOMLValue::Array(_) => ArrayType::Array,
&TOMLValue::String(_,_) => ArrayType::String,
&TOMLValue::InlineTable(_) => ArrayType::InlineTable,
&TOMLValue::Table => panic!("Cannot have a table in an array"),
}
And currently it gets reformatted like this
match val {
&TOMLValue::Integer(_) => ArrayType::Integer,
&TOMLValue::Float(_) => ArrayType::Float,
&TOMLValue::Boolean(_) => ArrayType::Boolean,
&TOMLValue::DateTime(_) => ArrayType::DateTime,
&TOMLValue::Array(_) => ArrayType::Array,
&TOMLValue::String(_, _) => ArrayType::String,
&TOMLValue::InlineTable(_) => ArrayType::InlineTable,
&TOMLValue::Table => panic!("Cannot have a table in an array"),
}
It would be nice if rustfmt offered an option like match_align_arms
that can have multiple values:
Always
: rustfmt will try to align all (non-block) match armsPreserve
: rustfmt will preserve alignment if it is already aligned manually. For matches that are not already aligned, current behavior will be used.Never
: current behavior
I think Preserve
should be the default behavior.
/cc @joelself