]> git.lizzy.rs Git - rust.git/commitdiff
Change defaults to RFC style
authorNick Cameron <ncameron@mozilla.com>
Mon, 12 Jun 2017 03:50:43 +0000 (15:50 +1200)
committerNick Cameron <ncameron@mozilla.com>
Tue, 13 Jun 2017 02:37:04 +0000 (14:37 +1200)
Cargo.toml
README.md
legacy-rustfmt.toml [new file with mode: 0644]
rfc-rustfmt.toml [deleted file]
src/config.rs

index 75a8ce749749079801f1122c42178e03835d12b4..a79c974b31ddf4a38eaad49bd144452b9798f15e 100644 (file)
@@ -1,7 +1,7 @@
 [package]
 
 name = "rustfmt"
-version = "0.8.6"
+version = "0.9"
 authors = ["Nicholas Cameron <ncameron@mozilla.com>", "The Rustfmt developers"]
 description = "Tool to find and fix Rust formatting issues"
 repository = "https://github.com/rust-lang-nursery/rustfmt"
index fa4e9d6c4e2392859cc4020be2faafbb4ead00f0..d60da4dec755a784177e3458a6d410c714fc2345 100644 (file)
--- a/README.md
+++ b/README.md
@@ -5,6 +5,11 @@ A tool for formatting Rust code according to style guidelines.
 If you'd like to help out (and you should, it's a fun project!), see
 [Contributing.md](Contributing.md).
 
+We are changing the default style used by rustfmt. There is an ongoing [RFC process](https://github.com/rust-lang-nursery/fmt-rfcs).
+The last version using the old style was 0.8.5. From 0.9 onwards, the RFC style
+is the default. If you want the old style back, you can use [legacy-rustfmt.toml](legacy-rustfmt.toml)
+as your rustfmt.toml.
+
 If you want latest and greatest, you should use the [libsyntax](https://github.com/rust-lang-nursery/rustfmt/tree/libsyntax)
 branch. It supports some newer Rust syntax which is missing from master and
 fixes some bugs. However, it links against libsyntax from the Rust compiler, so
diff --git a/legacy-rustfmt.toml b/legacy-rustfmt.toml
new file mode 100644 (file)
index 0000000..da1da76
--- /dev/null
@@ -0,0 +1,8 @@
+fn_args_layout = "Visual"
+array_layout = "Visual"
+control_style = "Legacy"
+where_style = "Legacy"
+generics_indent = "Visual"
+fn_call_style = "Visual"
+combine_control_expr = false
+fn_args_paren_newline = true
diff --git a/rfc-rustfmt.toml b/rfc-rustfmt.toml
deleted file mode 100644 (file)
index 893996b..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-fn_args_layout = "Block"
-array_layout = "Block"
-control_style = "Rfc"
-where_style = "Rfc"
-generics_indent = "Block"
-fn_call_style = "Block"
-combine_control_expr = true
-fn_args_paren_newline = false
index 082b731a00260a366e14ce0d0d8726e7704fe960..55518ebad979a16c3a3eaf3e9d2d14220bfd682b 100644 (file)
@@ -498,7 +498,7 @@ pub fn get_toml_path(dir: &Path) -> Result<Option<PathBuf>, Error> {
     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::Legacy, "Indent style for control flow statements";
+    control_style: Style, Style::Rfc, "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";
@@ -508,16 +508,16 @@ pub fn get_toml_path(dir: &Path) -> Result<Option<PathBuf>, Error> {
     fn_single_line: bool, false, "Put single-expression functions on a single line";
     fn_return_indent: ReturnIndent, ReturnIndent::WithArgs,
         "Location of return type in function declaration";
-    fn_args_paren_newline: bool, true, "If function argument parenthesis goes on a newline";
+    fn_args_paren_newline: bool, false, "If function argument parenthesis goes on a newline";
     fn_args_density: Density, Density::Tall, "Argument density in functions";
-    fn_args_layout: IndentStyle, IndentStyle::Visual,
+    fn_args_layout: IndentStyle, IndentStyle::Block,
         "Layout of function arguments and tuple structs";
-    array_layout: IndentStyle, IndentStyle::Visual, "Indent on arrays";
+    array_layout: IndentStyle, IndentStyle::Block, "Indent on arrays";
     array_width: usize, 60,
         "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::Legacy, "Overall strategy for where clauses";
+    where_style: Style, Style::Rfc, "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?
@@ -526,11 +526,11 @@ pub fn get_toml_path(dir: &Path) -> Result<Option<PathBuf>, Error> {
     where_layout: ListTactic, ListTactic::Vertical, "Element layout inside a where clause";
     where_pred_indent: IndentStyle, IndentStyle::Visual,
         "Indentation style of a where predicate";
-    generics_indent: IndentStyle, IndentStyle::Visual, "Indentation of generics";
+    generics_indent: IndentStyle, IndentStyle::Block, "Indentation of generics";
     struct_lit_style: IndentStyle, IndentStyle::Block, "Style of struct definition";
     struct_lit_multiline_style: MultilineStyle, MultilineStyle::PreferSingle,
         "Multiline style on literal structs";
-    fn_call_style: IndentStyle, IndentStyle::Visual, "Indentation for function calls, etc.";
+    fn_call_style: IndentStyle, IndentStyle::Block, "Indentation for function calls, etc.";
     report_todo: ReportTactic, ReportTactic::Never,
         "Report all, none or unnumbered occurrences of TODO in source file comments";
     report_fixme: ReportTactic, ReportTactic::Never,
@@ -580,7 +580,7 @@ pub fn get_toml_path(dir: &Path) -> Result<Option<PathBuf>, Error> {
         "What Write Mode to use when none is supplied: Replace, Overwrite, Display, Diff, Coverage";
     condense_wildcard_suffixes: bool, false, "Replace strings of _ wildcards by a single .. in \
                                               tuple patterns";
-    combine_control_expr: bool, false, "Combine control expressions with funciton calls."
+    combine_control_expr: bool, true, "Combine control expressions with funciton calls."
 }
 
 #[cfg(test)]