From cdc3f9321cbb88bc336eb7a2ef76e7f8c5dabf06 Mon Sep 17 00:00:00 2001 From: Nick Cameron Date: Fri, 2 Jun 2017 11:44:38 +1200 Subject: [PATCH] Rename the Style::Default option to Legacy --- src/config.rs | 6 +++--- src/expr.rs | 6 +++--- tests/source/configs-where_style-default.rs | 2 +- tests/target/configs-where_style-default.rs | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/config.rs b/src/config.rs index c4f078c5536..1d912093c2e 100644 --- a/src/config.rs +++ b/src/config.rs @@ -33,7 +33,7 @@ macro_rules! configuration_option_enum{ configuration_option_enum! { Style: Rfc, // Follow the style RFCs style. - Default, // Follow the traditional Rustfmt style. + Legacy, // Follow the traditional Rustfmt style. } configuration_option_enum! { NewlineStyle: @@ -498,7 +498,7 @@ create_config! { newline_style: NewlineStyle, NewlineStyle::Unix, "Unix or Windows line endings"; fn_brace_style: BraceStyle, BraceStyle::SameLineWhere, "Brace style for functions"; item_brace_style: BraceStyle, BraceStyle::SameLineWhere, "Brace style for structs and enums"; - control_style: Style, Style::Default, "Indent style for control flow statements"; + control_style: Style, Style::Legacy, "Indent style for control flow statements"; control_brace_style: ControlBraceStyle, ControlBraceStyle::AlwaysSameLine, "Brace style for control flow constructs"; impl_empty_single_line: bool, true, "Put empty-body implementations on a single line"; @@ -517,7 +517,7 @@ create_config! { "Maximum width of an array literal before falling back to vertical formatting"; type_punctuation_density: TypeDensity, TypeDensity::Wide, "Determines if '+' or '=' are wrapped in spaces in the punctuation of types"; - where_style: Style, Style::Default, "Overall strategy for where clauses"; + where_style: Style, Style::Legacy, "Overall strategy for where clauses"; // TODO: // 1. Should we at least try to put the where clause on the same line as the rest of the // function decl? diff --git a/src/expr.rs b/src/expr.rs index ed896231ba9..c9b9284bb30 100644 --- a/src/expr.rs +++ b/src/expr.rs @@ -327,7 +327,7 @@ pub fn rewrite_pair(lhs: &LHS, // Re-evaluate the rhs because we have more space now: let infix = infix.trim_right(); let rhs_shape = match context.config.control_style() { - Style::Default => { + Style::Legacy => { try_opt!(shape.sub_width(suffix.len() + prefix.len())).visual_indent(prefix.len()) } Style::Rfc => { @@ -339,7 +339,7 @@ pub fn rewrite_pair(lhs: &LHS, let rhs_result = try_opt!(rhs.rewrite(context, rhs_shape)); let lhs_shape = match context.config.control_style() { - Style::Default => { + Style::Legacy => { let lhs_overhead = shape.used_width() + prefix.len() + infix.len(); Shape { width: try_opt!(context.config.max_width().checked_sub(lhs_overhead)), @@ -914,7 +914,7 @@ impl<'a> Rewrite for ControlFlow<'a> { let pat_expr_string = match self.cond { Some(cond) => { let mut cond_shape = match context.config.control_style() { - Style::Default => try_opt!(constr_shape.shrink_left(add_offset)), + Style::Legacy => try_opt!(constr_shape.shrink_left(add_offset)), Style::Rfc => try_opt!(constr_shape.sub_width(add_offset)), }; if context.config.control_brace_style() != ControlBraceStyle::AlwaysNextLine { diff --git a/tests/source/configs-where_style-default.rs b/tests/source/configs-where_style-default.rs index 98f514b0c1e..e082f863f33 100644 --- a/tests/source/configs-where_style-default.rs +++ b/tests/source/configs-where_style-default.rs @@ -1,4 +1,4 @@ -// rustfmt-where_style: Default +// rustfmt-where_style: Legacy // Where style fn lorem() -> T where Ipsum: Eq, Dolor: Eq, Sit: Eq, Amet: Eq { diff --git a/tests/target/configs-where_style-default.rs b/tests/target/configs-where_style-default.rs index 3e1a3c93dfe..2971ac4c5e6 100644 --- a/tests/target/configs-where_style-default.rs +++ b/tests/target/configs-where_style-default.rs @@ -1,4 +1,4 @@ -// rustfmt-where_style: Default +// rustfmt-where_style: Legacy // Where style fn lorem() -> T