rust/tests/target/configs/use_small_heuristics/default.rs
Yacin Tmimi fe8b72d98e implement single_line_let_else_max_width
This allows users to configure the maximum length of a single line
`let-else` statements. `let-else` statements that otherwise meet the
requirements to be formatted on a single line will have their divergent
`else` block formatted over multiple lines if they exceed this length.

**Note**: `single_line_let_else_max_widt` will be introduced as a stable
configuration option.
2023-07-01 01:06:35 -05:00

39 lines
638 B
Rust

// rustfmt-use_small_heuristics: Default
enum Lorem {
Ipsum,
Dolor(bool),
Sit { amet: Consectetur, adipiscing: Elit },
}
fn main() {
lorem(
"lorem",
"ipsum",
"dolor",
"sit",
"amet",
"consectetur",
"adipiscing",
);
let lorem = Lorem {
ipsum: dolor,
sit: amet,
};
let lorem = if ipsum { dolor } else { sit };
}
fn format_let_else() {
let Some(a) = opt else {};
let Some(b) = opt else { return };
let Some(c) = opt else { return };
let Some(d) = some_very_very_very_very_long_name else {
return;
};
}