Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stabilise fn_args_density #3581

Merged
merged 9 commits into from
Jun 3, 2019
Prev Previous commit
Next Next commit
rename the fn_args_layout associated enum from Density to ItemsLayout
scampi committed May 30, 2019

Verified

This commit was signed with the committer’s verified signature. The key has expired.
scampi Stéphane Campinas
commit 7c08d3742ec3f9626efd4eec7db320131a1b8f6b
3 changes: 2 additions & 1 deletion src/config/mod.rs
Original file line number Diff line number Diff line change
@@ -92,7 +92,8 @@ create_config! {
the same line with the pattern of arms";
force_multiline_blocks: bool, false, false,
"Force multiline closure bodies and match arms to be wrapped in a block";
fn_args_layout: Density, Density::Tall, true, "Argument density in functions";
fn_args_layout: ItemsLayout, ItemsLayout::Tall, true,
"Control the layout of arguments in a function";
brace_style: BraceStyle, BraceStyle::SameLineWhere, false, "Brace style for items";
control_brace_style: ControlBraceStyle, ControlBraceStyle::AlwaysSameLine, false,
"Brace style for control flow constructs";
12 changes: 6 additions & 6 deletions src/config/options.rs
Original file line number Diff line number Diff line change
@@ -58,7 +58,7 @@ pub enum IndentStyle {

#[config_type]
/// How to place a list-like items.
pub enum Density {
pub enum ItemsLayout {
/// Fit as much on one line as possible.
Compressed,
/// Items are placed horizontally if sufficient space, vertically otherwise.
@@ -87,13 +87,13 @@ pub enum Heuristics {
Default,
}

impl Density {
impl ItemsLayout {
pub fn to_list_tactic(self, len: usize) -> ListTactic {
match self {
Density::Compressed => ListTactic::Mixed,
Density::Tall => ListTactic::HorizontalVertical,
Density::Vertical if len == 1 => ListTactic::Horizontal,
Density::Vertical => ListTactic::Vertical,
ItemsLayout::Compressed => ListTactic::Mixed,
ItemsLayout::Tall => ListTactic::HorizontalVertical,
ItemsLayout::Vertical if len == 1 => ListTactic::Horizontal,
ItemsLayout::Vertical => ListTactic::Vertical,
}
}
}