Rename the Style::Default option to Legacy

This commit is contained in:
Nick Cameron 2017-06-02 11:44:38 +12:00
parent 0480f7e105
commit cdc3f9321c
4 changed files with 8 additions and 8 deletions

View File

@ -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?

View File

@ -327,7 +327,7 @@ pub fn rewrite_pair<LHS, RHS>(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, RHS>(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 {

View File

@ -1,4 +1,4 @@
// rustfmt-where_style: Default
// rustfmt-where_style: Legacy
// Where style
fn lorem<Ipsum, Dolor, Sit, Amet>() -> T where Ipsum: Eq, Dolor: Eq, Sit: Eq, Amet: Eq {

View File

@ -1,4 +1,4 @@
// rustfmt-where_style: Default
// rustfmt-where_style: Legacy
// Where style
fn lorem<Ipsum, Dolor, Sit, Amet>() -> T