From dd1fbca99a9518c6a0dfedd77300d0856c9d4a21 Mon Sep 17 00:00:00 2001 From: Nick Cameron Date: Fri, 24 Nov 2017 20:17:06 +1300 Subject: [PATCH] Replace various small width heuristics with a single option Closes #1984 --- Configurations.md | 218 +++++------------- src/chains.rs | 2 +- src/config.rs | 121 ++++++++-- src/expr.rs | 34 +-- src/items.rs | 5 +- src/lists.rs | 2 +- src/macros.rs | 2 +- tests/config/small_tabs.toml | 1 - tests/source/chains-visual.rs | 1 - tests/source/chains.rs | 3 +- ...horizontal_layout_threshold-1000-visual.rs | 108 --------- ...-array_horizontal_layout_threshold-1000.rs | 107 --------- tests/source/configs-array_width-above.rs | 6 - tests/source/configs-array_width-below.rs | 6 - tests/source/configs-chain_width-above.rs | 6 - tests/source/configs-chain_width-below.rs | 6 - tests/source/configs-fn_call_width-above.rs | 6 - tests/source/configs-fn_call_width-below.rs | 6 - tests/source/configs-fn_call_width-zero.rs | 7 - ...igs-single_line_if_else_max_width-above.rs | 6 - ...igs-single_line_if_else_max_width-below.rs | 6 - .../configs-struct_lit_single_line-true.rs | 7 - .../source/configs-struct_lit_width-above.rs | 6 - .../source/configs-struct_lit_width-below.rs | 6 - .../configs-struct_variant_width-above.rs | 8 - .../configs-struct_variant_width-below.rs | 8 - .../else-if-brace-style-always-next-line.rs | 1 - .../else-if-brace-style-always-same-line.rs | 1 - .../else-if-brace-style-closing-next-line.rs | 1 - tests/source/hard-tabs.rs | 1 - tests/source/single-line-if-else.rs | 1 - tests/target/chains-visual.rs | 13 +- tests/target/chains.rs | 18 +- ...horizontal_layout_threshold-1000-visual.rs | 96 -------- ...-array_horizontal_layout_threshold-1000.rs | 94 -------- tests/target/configs-array_width-above.rs | 14 -- tests/target/configs-array_width-below.rs | 6 - tests/target/configs-chain_width-above.rs | 12 - tests/target/configs-chain_width-below.rs | 6 - tests/target/configs-fn_call_width-above.rs | 15 -- tests/target/configs-fn_call_width-below.rs | 6 - tests/target/configs-fn_call_width-zero.rs | 9 - ...igs-single_line_if_else_max_width-above.rs | 10 - ...igs-single_line_if_else_max_width-below.rs | 6 - .../configs-struct_lit_single_line-true.rs | 7 - .../target/configs-struct_lit_width-above.rs | 9 - .../target/configs-struct_lit_width-below.rs | 6 - .../target/configs-struct_variant_width-0.rs | 29 --- .../configs-struct_variant_width-above.rs | 11 - .../configs-struct_variant_width-below.rs | 8 - .../else-if-brace-style-always-next-line.rs | 10 +- .../else-if-brace-style-always-same-line.rs | 7 +- .../else-if-brace-style-closing-next-line.rs | 8 +- tests/target/hard-tabs.rs | 9 +- tests/target/issue-1802.rs | 7 +- tests/target/single-line-if-else.rs | 14 +- 56 files changed, 214 insertions(+), 915 deletions(-) delete mode 100644 tests/source/configs-array_horizontal_layout_threshold-1000-visual.rs delete mode 100644 tests/source/configs-array_horizontal_layout_threshold-1000.rs delete mode 100644 tests/source/configs-array_width-above.rs delete mode 100644 tests/source/configs-array_width-below.rs delete mode 100644 tests/source/configs-chain_width-above.rs delete mode 100644 tests/source/configs-chain_width-below.rs delete mode 100644 tests/source/configs-fn_call_width-above.rs delete mode 100644 tests/source/configs-fn_call_width-below.rs delete mode 100644 tests/source/configs-fn_call_width-zero.rs delete mode 100644 tests/source/configs-single_line_if_else_max_width-above.rs delete mode 100644 tests/source/configs-single_line_if_else_max_width-below.rs delete mode 100644 tests/source/configs-struct_lit_single_line-true.rs delete mode 100644 tests/source/configs-struct_lit_width-above.rs delete mode 100644 tests/source/configs-struct_lit_width-below.rs delete mode 100644 tests/source/configs-struct_variant_width-above.rs delete mode 100644 tests/source/configs-struct_variant_width-below.rs delete mode 100644 tests/target/configs-array_horizontal_layout_threshold-1000-visual.rs delete mode 100644 tests/target/configs-array_horizontal_layout_threshold-1000.rs delete mode 100644 tests/target/configs-array_width-above.rs delete mode 100644 tests/target/configs-array_width-below.rs delete mode 100644 tests/target/configs-chain_width-above.rs delete mode 100644 tests/target/configs-chain_width-below.rs delete mode 100644 tests/target/configs-fn_call_width-above.rs delete mode 100644 tests/target/configs-fn_call_width-below.rs delete mode 100644 tests/target/configs-fn_call_width-zero.rs delete mode 100644 tests/target/configs-single_line_if_else_max_width-above.rs delete mode 100644 tests/target/configs-single_line_if_else_max_width-below.rs delete mode 100644 tests/target/configs-struct_lit_single_line-true.rs delete mode 100644 tests/target/configs-struct_lit_width-above.rs delete mode 100644 tests/target/configs-struct_lit_width-below.rs delete mode 100644 tests/target/configs-struct_variant_width-0.rs delete mode 100644 tests/target/configs-struct_variant_width-above.rs delete mode 100644 tests/target/configs-struct_variant_width-below.rs diff --git a/Configurations.md b/Configurations.md index 275d4883760..968b5a2d634 100644 --- a/Configurations.md +++ b/Configurations.md @@ -6,7 +6,6 @@ A possible content of `rustfmt.toml` or `.rustfmt.toml` might look like this: ```toml indent_style = "Block" -array_width = 80 reorder_imported_names = true ``` @@ -14,41 +13,6 @@ reorder_imported_names = true Below you find a detailed visual guide on all the supported configuration options of rustfmt: -## `array_horizontal_layout_threshold` - -How many elements array must have before rustfmt uses horizontal layout. -Use this option to prevent a huge array from being vertically formatted. - -- **Default value**: `0` -- **Possible values**: any positive integer - -**Note:** A value of `0` results in [`indent_style`](#indent_style) being applied regardless of a line's width. - -#### `0` (default): - -```rust -// Each element will be placed on its own line. -let a = vec![ - 0, - 1, - 2, - 3, - 4, - ... - 999, - 1000, -]; -``` - -#### `1000`: - -```rust -// Each element will be placed on the same line as much as possible. -let a = vec![ - 0, 1, 2, 3, 4, ... - ..., 999, 1000, -]; -``` ## `indent_style` @@ -279,22 +243,6 @@ fn lorem() -> T See also: [`where_density`](#where_density), [`where_layout`](#where_layout). -## `array_width` - -Maximum width of an array literal before falling back to vertical formatting - -- **Default value**: `60` -- **Possible values**: any positive integer - -**Note:** A value of `0` results in [`indent_style`](#indent_style) being applied regardless of a line's width. - -#### Lines shorter than `array_width`: -```rust -let lorem = vec!["ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing", "elit"]; -``` - -#### Lines longer than `array_width`: -See [`indent_style`](#indent_style). ## `same_line_attributes` @@ -341,6 +289,66 @@ enum Lorem { } ``` +## `use_small_heuristics` + +Whether to use different formatting for items and expressions if they satisfy a heuristic notion of 'small'. + +- **Default value**: `true` +- **Possible values**: `true`, `false` + +#### `true` (default): + +```rust +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 }; +} +``` + +#### `false`: + +```rust +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 + }; +} +``` ## `binop_separator` @@ -409,22 +417,6 @@ let lorem = ipsum.dolor() .elit(); ``` -See also [`chain_width`](#chain_width). - -## `chain_width` - -Maximum length of a chain to fit on a single line - -- **Default value**: `60` -- **Possible values**: any positive integer - -#### Lines shorter than `chain_width`: -```rust -let lorem = ipsum.dolor().sit().amet().consectetur().adipiscing().elit(); -``` - -#### Lines longer than `chain_width`: -See [`chain_indent`](#chain_indent). ## `combine_control_expr` @@ -883,23 +875,7 @@ struct Dolor } ``` -## `fn_call_width` -Maximum width of the args of a function call before falling back to vertical formatting - -- **Default value**: `60` -- **Possible values**: any positive integer - -**Note:** A value of `0` results in vertical formatting being applied regardless of a line's width. - -#### Function call shorter than `fn_call_width`: -```rust -lorem("lorem", "ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing", "elit"); -``` - -#### Function call longer than `fn_call_width`: - -See [`indent_style`](#indent_style). ## `fn_empty_single_line` @@ -1533,30 +1509,6 @@ it contains a `#X` (with `X` being a number) in parentheses following the See also [`report_todo`](#report_todo). -## `single_line_if_else_max_width` - -Maximum line length for single line if-else expressions. - -- **Default value**: `50` -- **Possible values**: any positive integer - -**Note:** A value of `0` results in if-else expressions being broken regardless of their line's width. - -#### Lines shorter than `single_line_if_else_max_width`: -```rust -let lorem = if ipsum { dolor } else { sit }; -``` - -#### Lines longer than `single_line_if_else_max_width`: -```rust -let lorem = if ipsum { - dolor -} else { - sit -}; -``` - -See also: [`control_brace_style`](#control_brace_style). ## `skip_children` @@ -1768,56 +1720,8 @@ let lorem = Lorem { }; ``` -See also: [`indent_style`](#indent_style), [`struct_lit_width`](#struct_lit_width). +See also: [`indent_style`](#indent_style). -## `struct_lit_width` - -Maximum width in the body of a struct lit before falling back to vertical formatting - -- **Default value**: `18` -- **Possible values**: any positive integer - -**Note:** A value of `0` results in vertical formatting being applied regardless of a line's width. - -#### Lines shorter than `struct_lit_width`: -```rust -let lorem = Lorem { ipsum: dolor, sit: amet }; -``` - -#### Lines longer than `struct_lit_width`: -See [`indent_style`](#indent_style). - -See also: [`struct_lit_single_line`](#struct_lit_single_line), [`indent_style`](#indent_style). - -## `struct_variant_width` - -Maximum width in the body of a struct variant before falling back to vertical formatting - -- **Default value**: `35` -- **Possible values**: any positive integer - -**Note:** A value of `0` results in vertical formatting being applied regardless of a line's width. - -#### Struct variants shorter than `struct_variant_width`: -```rust -enum Lorem { - Ipsum, - Dolor(bool), - Sit { amet: Consectetur, adipiscing: Elit }, -} -``` - -#### Struct variants longer than `struct_variant_width`: -```rust -enum Lorem { - Ipsum, - Dolor(bool), - Sit { - amet: Consectetur, - adipiscing: Elit, - }, -} -``` ## `tab_spaces` diff --git a/src/chains.rs b/src/chains.rs index 526eebfd262..1442f6b84a1 100644 --- a/src/chains.rs +++ b/src/chains.rs @@ -161,7 +161,7 @@ pub fn rewrite_chain(expr: &ast::Expr, context: &RewriteContext, shape: Shape) - let one_line_budget = if rewrites.is_empty() { shape.width } else { - min(shape.width, context.config.chain_width()) + min(shape.width, context.config.width_heuristics().chain_width) }; let all_in_one_line = !parent_rewrite_contains_newline && rewrites.iter().all(|s| !s.contains('\n')) diff --git a/src/config.rs b/src/config.rs index 1536d8f4a6a..22c6cd6121d 100644 --- a/src/config.rs +++ b/src/config.rs @@ -12,6 +12,7 @@ extern crate toml; use std::{env, fs}; use std::cell::Cell; +use std::default::Default; use std::fs::File; use std::io::{Error, ErrorKind, Read}; use std::path::{Path, PathBuf}; @@ -132,6 +133,68 @@ configuration_option_enum! { Color: Auto, } +#[derive(Deserialize, Serialize, Clone, Debug)] +pub struct WidthHeuristics { + // Maximum width of the args of a function call before falling back + // to vertical formatting. + pub fn_call_width: usize, + // Maximum width in the body of a struct lit before falling back to + // vertical formatting. + pub struct_lit_width: usize, + // Maximum width in the body of a struct variant before falling back + // to vertical formatting. + pub struct_variant_width: usize, + // Maximum width of an array literal before falling back to vertical + // formatting. + pub array_width: usize, + // Maximum length of a chain to fit on a single line. + pub chain_width: usize, + // Maximum line length for single line if-else expressions. A value + // of zero means always break if-else expressions. + pub single_line_if_else_max_width: usize, +} + +impl WidthHeuristics { + // Using this WidthHeuristics means we ignore heuristics. + fn null() -> WidthHeuristics { + WidthHeuristics { + fn_call_width: usize::max_value(), + struct_lit_width: 0, + struct_variant_width: 0, + array_width: usize::max_value(), + chain_width: usize::max_value(), + single_line_if_else_max_width: 0, + } + } +} + +impl Default for WidthHeuristics { + fn default() -> WidthHeuristics { + WidthHeuristics { + fn_call_width: 60, + struct_lit_width: 18, + struct_variant_width: 35, + array_width: 60, + chain_width: 60, + single_line_if_else_max_width: 50, + } + } +} + +impl ::std::str::FromStr for WidthHeuristics { + type Err = &'static str; + + fn from_str(_: &str) -> Result { + Err("WidthHeuristics is not parsable") + } +} + +impl ::config::ConfigType for WidthHeuristics { + fn doc_hint() -> String { + String::new() + } +} + /// Trait for types that can be used in `Config`. pub trait ConfigType: Sized { /// Returns hint text for use in `Config::print_docs()`. For enum types, this is a @@ -216,9 +279,11 @@ macro_rules! create_config { impl PartialConfig { pub fn to_toml(&self) -> Result { - // file_lines can't be specified in TOML + // Non-user-facing options can't be specified in TOML let mut cloned = self.clone(); cloned.file_lines = None; + cloned.verbose = None; + cloned.width_heuristics = None; toml::to_string(&cloned) .map_err(|e| format!("Could not output config: {}", e.to_string())) @@ -236,6 +301,9 @@ macro_rules! create_config { $( pub fn $i(&mut self, value: $ty) { (self.0).$i.2 = value; + if stringify!($i) == "use_small_heuristics" { + self.0.set_heuristics(); + } } )+ } @@ -303,6 +371,7 @@ macro_rules! create_config { } } )+ + self.set_heuristics(); self } @@ -374,6 +443,10 @@ macro_rules! create_config { )+ _ => panic!("Unknown config key in override: {}", key) } + + if key == "use_small_heuristics" { + self.set_heuristics(); + } } /// Construct a `Config` from the toml file specified at `file_path`. @@ -461,6 +534,14 @@ macro_rules! create_config { println!(); )+ } + + fn set_heuristics(&mut self) { + if self.use_small_heuristics.2 { + self.set().width_heuristics(WidthHeuristics::default()); + } else { + self.set().width_heuristics(WidthHeuristics::null()); + } + } } // Template for the default configuration @@ -507,6 +588,8 @@ create_config! { tab_spaces: usize, 4, true, "Number of spaces per tab"; newline_style: NewlineStyle, NewlineStyle::Unix, true, "Unix or Windows line endings"; indent_style: IndentStyle, IndentStyle::Block, false, "How do we indent expressions or items."; + use_small_heuristics: bool, true, false, "Whether to use different formatting for items and\ + expressions if they satisfy a heuristic notion of 'small'."; // strings and comments format_strings: bool, false, false, "Format string literals where necessary"; @@ -515,22 +598,6 @@ create_config! { "Maximum length of comments. No effect unless wrap_comments = true"; normalize_comments: bool, false, true, "Convert /* */ comments to // comments where possible"; - // Width heuristics - fn_call_width: usize, 60, false, - "Maximum width of the args of a function call before falling back to vertical formatting"; - struct_lit_width: usize, 18, false, - "Maximum width in the body of a struct lit before falling back to vertical formatting"; - struct_variant_width: usize, 35, false, - "Maximum width in the body of a struct variant before falling back to vertical formatting"; - array_width: usize, 60, false, - "Maximum width of an array literal before falling back to vertical formatting"; - array_horizontal_layout_threshold: usize, 0, false, - "How many elements array must have before rustfmt uses horizontal layout."; - chain_width: usize, 60, false, "Maximum length of a chain to fit on a single line"; - single_line_if_else_max_width: usize, 50, false, "Maximum line length for single line if-else \ - expressions. A value of zero means always break \ - if-else expressions."; - // Single line expressions and items. struct_lit_single_line: bool, true, false, "Put small struct literals on a single line"; @@ -618,12 +685,8 @@ create_config! { "Require a specific version of rustfmt."; unstable_features: bool, false, true, "Enables unstable features. Only available on nightly channel"; - verbose: bool, false, false, "Use verbose output"; disable_all_formatting: bool, false, false, "Don't reformat anything"; skip_children: bool, false, false, "Don't reformat out of line modules"; - file_lines: FileLines, FileLines::all(), false, - "Lines to format; this is not supported in rustfmt.toml, and can only be specified \ - via the --file-lines option"; error_on_line_overflow: bool, true, false, "Error if unable to get all lines within max_width"; error_on_line_overflow_comments: bool, true, false, "Error if unable to get comments within max_width"; @@ -631,6 +694,14 @@ create_config! { "Report all, none or unnumbered occurrences of TODO in source file comments"; report_fixme: ReportTactic, ReportTactic::Never, false, "Report all, none or unnumbered occurrences of FIXME in source file comments"; + + // Not user-facing. + verbose: bool, false, false, "Use verbose output"; + file_lines: FileLines, FileLines::all(), false, + "Lines to format; this is not supported in rustfmt.toml, and can only be specified \ + via the --file-lines option"; + width_heuristics: WidthHeuristics, WidthHeuristics::default(), false, + "'small' heuristic values"; } #[cfg(test)] @@ -650,14 +721,18 @@ mod test { fn test_config_used_to_toml() { let config = Config::default(); - let verbose = config.verbose(); + let merge_derives = config.merge_derives(); let skip_children = config.skip_children(); let used_options = config.used_options(); let toml = used_options.to_toml().unwrap(); assert_eq!( toml, - format!("verbose = {}\nskip_children = {}\n", verbose, skip_children) + format!( + "merge_derives = {}\nskip_children = {}\n", + merge_derives, + skip_children, + ) ); } diff --git a/src/expr.rs b/src/expr.rs index b9c33a52be7..fb71d5c054b 100644 --- a/src/expr.rs +++ b/src/expr.rs @@ -451,13 +451,14 @@ where .iter() .any(|li| li.item.as_ref().map(|s| s.len() > 10).unwrap_or(false)); - let mut tactic = match context.config.indent_style() { + let tactic = match context.config.indent_style() { IndentStyle::Block => { // FIXME wrong shape in one-line case match shape.width.checked_sub(2 * bracket_size) { Some(width) => { - let tactic = - ListTactic::LimitedHorizontalVertical(context.config.array_width()); + let tactic = ListTactic::LimitedHorizontalVertical( + context.config.width_heuristics().array_width, + ); definitive_tactic(&items, tactic, Separator::Comma, width) } None => DefinitiveListTactic::Vertical, @@ -466,7 +467,9 @@ where IndentStyle::Visual => if has_long_item || items.iter().any(ListItem::is_multiline) { definitive_tactic( &items, - ListTactic::LimitedHorizontalVertical(context.config.array_width()), + ListTactic::LimitedHorizontalVertical( + context.config.width_heuristics().array_width, + ), Separator::Comma, nested_shape.width, ) @@ -475,11 +478,6 @@ where }, }; let ends_with_newline = tactic.ends_with_newline(context.config.indent_style()); - if context.config.array_horizontal_layout_threshold() > 0 - && items.len() > context.config.array_horizontal_layout_threshold() - { - tactic = DefinitiveListTactic::Mixed; - } let fmt = ListFormatting { tactic: tactic, @@ -957,11 +955,21 @@ impl<'a> ControlFlow<'a> { && !last_line_extendable(&pat_expr_string); // Try to format if-else on single line. - if self.allow_single_line && context.config.single_line_if_else_max_width() > 0 { + if self.allow_single_line + && context + .config + .width_heuristics() + .single_line_if_else_max_width > 0 + { let trial = self.rewrite_single_line(&pat_expr_string, context, shape.width); if let Some(cond_str) = trial { - if cond_str.len() <= context.config.single_line_if_else_max_width() { + if cond_str.len() + <= context + .config + .width_heuristics() + .single_line_if_else_max_width + { return Some((cond_str, 0)); } } @@ -1795,7 +1803,7 @@ pub fn rewrite_call( &ptr_vec_to_ref_vec(args), span, shape, - context.config.fn_call_width(), + context.config.width_heuristics().fn_call_width, force_trailing_comma, ) } @@ -2521,7 +2529,7 @@ where items, span, shape, - context.config.fn_call_width(), + context.config.width_heuristics().fn_call_width, force_trailing_comma, ) } else { diff --git a/src/items.rs b/src/items.rs index c99a4db0fdf..695ee71f0c3 100644 --- a/src/items.rs +++ b/src/items.rs @@ -502,7 +502,8 @@ impl<'a> FmtVisitor<'a> { false, ).collect() }; - let mut items: Vec<_> = itemize_list_with(self.config.struct_variant_width()); + let mut items: Vec<_> = + itemize_list_with(self.config.width_heuristics().struct_variant_width); // If one of the variants use multiple lines, use multi-lined formatting for all variants. let has_multiline_variant = items.iter().any(|item| item.inner_as_ref().contains("\n")); let has_single_line_variant = items.iter().any(|item| !item.inner_as_ref().contains("\n")); @@ -1324,7 +1325,7 @@ fn format_tuple_struct( } else { let shape = Shape::indented(offset, context.config); let fields = &fields.iter().map(|field| field).collect::>()[..]; - let one_line_width = context.config.fn_call_width(); + let one_line_width = context.config.width_heuristics().fn_call_width; result = rewrite_call_inner(context, &result, fields, span, shape, one_line_width, false)?; } diff --git a/src/lists.rs b/src/lists.rs index 5f8149c6f3e..edc896e26c2 100644 --- a/src/lists.rs +++ b/src/lists.rs @@ -780,7 +780,7 @@ pub fn struct_lit_shape( }; let shape_width = shape.width.checked_sub(prefix_width + suffix_width); if let Some(w) = shape_width { - let shape_width = cmp::min(w, context.config.struct_lit_width()); + let shape_width = cmp::min(w, context.config.width_heuristics().struct_lit_width); Some((Some(Shape::legacy(shape_width, shape.indent)), v_shape)) } else { Some((None, v_shape)) diff --git a/src/macros.rs b/src/macros.rs index 6e64a49361d..8c8b50b7ca3 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -208,7 +208,7 @@ pub fn rewrite_macro( &arg_vec.iter().map(|e| &*e).collect::>()[..], mac.span, shape, - context.config.fn_call_width(), + context.config.width_heuristics().fn_call_width, trailing_comma, ).map(|rw| match position { MacroPosition::Item => format!("{};", rw), diff --git a/tests/config/small_tabs.toml b/tests/config/small_tabs.toml index 298ca5af9bd..472df014435 100644 --- a/tests/config/small_tabs.toml +++ b/tests/config/small_tabs.toml @@ -11,5 +11,4 @@ indent_style = "Block" report_todo = "Always" report_fixme = "Never" reorder_imports = false -single_line_if_else_max_width = 0 format_strings = true diff --git a/tests/source/chains-visual.rs b/tests/source/chains-visual.rs index 99dfa921a71..2fd36225881 100644 --- a/tests/source/chains-visual.rs +++ b/tests/source/chains-visual.rs @@ -1,5 +1,4 @@ // rustfmt-normalize_comments: true -// rustfmt-single_line_if_else_max_width: 0 // rustfmt-indent_style: Visual // Test chain formatting. diff --git a/tests/source/chains.rs b/tests/source/chains.rs index 6199eb77edc..f14a0293123 100644 --- a/tests/source/chains.rs +++ b/tests/source/chains.rs @@ -1,6 +1,5 @@ // rustfmt-normalize_comments: true -// rustfmt-single_line_if_else_max_width: 0 -// rustfmt-chain_width: 100 +// rustfmt-use_small_heuristics: false // Test chain formatting. fn main() { diff --git a/tests/source/configs-array_horizontal_layout_threshold-1000-visual.rs b/tests/source/configs-array_horizontal_layout_threshold-1000-visual.rs deleted file mode 100644 index 3036f3598ef..00000000000 --- a/tests/source/configs-array_horizontal_layout_threshold-1000-visual.rs +++ /dev/null @@ -1,108 +0,0 @@ -// rustfmt-array_horizontal_layout_threshold: 1000 -// rustfmt-indent_style: Visual - -const ARRAY: [u8; 2048] = - [99, 72, 48, 104, 44, 112, 38, 62, 40, 93, 23, 24, 32, 21, 102, 76, 65, 29, 116, - 21, 18, 37, 61, 10, 108, 31, 85, 93, 2, 108, 103, 77, 109, 40, 92, 88, 114, 32, 31, - 87, 69, 42, 38, 25, 105, 6, 61, 128, 45, 6, 43, 81, 7, 3, 1, 125, 24, 123, 2, - 29, 111, 120, 26, 0, 78, 36, 115, 86, 66, 10, 52, 87, 27, 125, 122, 42, 126, 101, - 70, 78, 90, 62, 72, 43, 3, 111, 8, 110, 11, 124, 124, 102, 74, 35, 9, 83, 22, 121, - 34, 70, 69, 52, 31, 92, 94, 67, 21, 76, 65, 10, 79, 54, 17, 58, 105, 13, 96, 61, 99, - 31, 87, 41, 78, 88, 120, 35, 95, 25, 80, 100, 45, 79, 49, 56, 5, 114, 11, 25, 16, 97, - 2, 43, 17, 71, 63, 102, 81, 55, 14, 59, 102, 55, 101, 119, 29, 58, 103, 2, 88, - 85, 9, 70, 91, 73, 37, 70, 123, 15, 68, 50, 76, 52, 46, 126, 87, 44, 85, 3, 97, - 59, 39, 37, 79, 110, 25, 109, 90, 124, 109, 6, 47, 60, 79, 15, 40, 3, 40, 20, 98, - 9, 21, 65, 119, 2, 20, 64, 56, 34, 116, 22, 125, 113, 57, 30, 21, 92, 76, 10, 107, - 61, 8, 124, 110, 87, 64, 99, 26, 122, 56, 127, 94, 8, 121, 19, 24, 27, 61, 34, - 44, 73, 82, 10, 49, 95, 72, 89, 27, 124, 75, 33, 64, 48, 73, 21, 101, 34, 47, - 103, 114, 11, 31, 11, 93, 31, 54, 102, 117, 38, 31, 33, 84, 72, 128, 91, 3, 84, 92, - 48, 69, 39, 97, 113, 70, 26, 96, 107, 117, 76, 59, 50, 43, 66, 21, 90, 31, 102, 45, - 66, 5, 115, 63, 61, 83, 37, 16, 78, 22, 120, 52, 24, 25, 70, 71, 54, 11, 103, 45, - 44, 101, 106, 53, 39, 116, 83, 4, 68, 12, 59, 3, 37, 112, 123, 7, 120, 127, 93, - 34, 101, 48, 114, 127, 65, 69, 16, 79, 125, 18, 71, 69, 72, 54, 60, 107, 52, 18, - 92, 105, 119, 17, 32, 23, 37, 8, 127, 99, 71, 54, 80, 109, 54, 51, 44, 20, 40, - 52, 46, 81, 28, 46, 82, 39, 39, 70, 3, 90, 41, 40, 36, 127, 48, 124, 26, 115, - 47, 93, 104, 4, 70, 88, 3, 4, 34, 75, 46, 16, 65, 114, 53, 51, 123, 16, 36, 98, - 36, 37, 36, 80, 71, 3, 116, 89, 52, 74, 7, 116, 39, 48, 51, 54, 56, 105, 90, 50, 67, - 111, 111, 7, 55, 87, 30, 15, 75, 50, 23, 9, 115, 2, 27, 45, 75, 29, 15, 15, 47, 33, - 119, 85, 11, 116, 127, 53, 37, 3, 0, 116, 77, 4, 37, 56, 8, 92, 105, 86, 101, - 79, 103, 98, 70, 122, 110, 38, 50, 52, 51, 62, 98, 95, 49, 21, 116, 30, 61, 1, - 36, 96, 33, 78, 75, 23, 118, 88, 10, 4, 91, 38, 32, 96, 64, 71, 89, 108, 10, 106, - 62, 86, 104, 24, 117, 2, 72, 99, 60, 117, 109, 67, 112, 124, 111, 102, 4, 126, 95, - 23, 68, 115, 106, 15, 103, 101, 19, 30, 7, 29, 109, 62, 93, 22, 30, 106, 7, 52, 77, - 88, 8, 32, 3, 63, 77, 14, 86, 82, 114, 104, 119, 122, 40, 92, 3, 98, 128, 53, - 74, 40, 1, 94, 5, 112, 59, 29, 128, 119, 33, 67, 42, 109, 30, 93, 40, 113, 13, 85, - 17, 51, 63, 57, 4, 2, 102, 93, 25, 61, 39, 110, 56, 21, 102, 25, 4, 113, 84, 63, - 64, 63, 73, 83, 39, 123, 113, 68, 83, 95, 7, 23, 18, 73, 52, 16, 41, 81, 38, 55, 82, - 59, 93, 6, 30, 25, 65, 67, 44, 99, 18, 77, 74, 62, 126, 36, 110, 66, 4, 86, 123, - 21, 109, 46, 93, 112, 107, 35, 14, 127, 112, 54, 65, 0, 59, 76, 47, 94, 6, 94, 86, - 49, 118, 44, 10, 15, 5, 105, 12, 28, 5, 94, 56, 31, 79, 86, 116, 18, 32, 69, 1, - 83, 36, 38, 71, 38, 71, 23, 71, 9, 30, 64, 2, 6, 21, 112, 55, 1, 43, 126, 33, 79, 97, - 49, 86, 7, 84, 40, 42, 25, 35, 51, 118, 56, 115, 104, 103, 20, 103, 95, 92, 43, - 50, 42, 34, 122, 116, 75, 31, 109, 53, 44, 6, 48, 1, 52, 119, 123, 32, 50, 63, - 114, 105, 16, 79, 53, 19, 78, 86, 110, 4, 43, 97, 3, 18, 110, 84, 70, 23, 84, 23, - 48, 125, 36, 58, 25, 90, 111, 103, 83, 38, 112, 127, 28, 53, 86, 67, 78, 126, 86, - 8, 41, 76, 10, 54, 11, 22, 3, 12, 2, 50, 91, 82, 90, 42, 108, 29, 72, 86, 34, 91, - 115, 46, 86, 28, 46, 22, 97, 104, 48, 8, 22, 92, 10, 71, 102, 52, 116, 65, 15, 102, - 8, 113, 53, 110, 49, 81, 102, 48, 91, 32, 18, 67, 49, 124, 35, 83, 37, 16, 31, 8, - 58, 48, 77, 104, 71, 60, 40, 44, 74, 2, 40, 12, 22, 23, 49, 17, 98, 21, 83, 117, 64, - 115, 44, 4, 46, 70, 47, 115, 24, 66, 71, 80, 59, 32, 46, 81, 118, 8, 29, 93, 86, 81, - 20, 44, 46, 4, 116, 107, 117, 11, 30, 78, 13, 61, 110, 45, 101, 113, 34, 102, 19, 64, - 10, 36, 68, 94, 40, 87, 74, 105, 81, 70, 58, 44, 46, 108, 90, 60, 32, 36, 23, 115, - 40, 97, 43, 58, 16, 120, 74, 52, 42, 49, 16, 62, 122, 97, 107, 15, 104, 13, 17, - 103, 49, 112, 123, 23, 107, 49, 40, 101, 62, 9, 71, 92, 70, 57, 37, 42, 21, 83, 2, - 20, 116, 22, 8, 34, 61, 56, 65, 115, 121, 116, 67, 111, 52, 80, 94, 46, 18, 68, 72, - 3, 61, 96, 127, 46, 7, 90, 100, 31, 30, 80, 123, 72, 74, 115, 74, 81, 45, 79, 121, - 57, 85, 117, 5, 88, 101, 97, 10, 12, 43, 57, 107, 83, 25, 12, 117, 103, 72, 115, 29, - 58, 101, 103, 120, 115, 74, 125, 127, 70, 7, 24, 92, 15, 103, 58, 83, 54, 75, 30, 9, - 111, 68, 53, 29, 25, 19, 96, 38, 93, 123, 126, 63, 115, 92, 119, 76, 50, 7, 9, - 101, 68, 26, 122, 5, 77, 4, 116, 89, 81, 21, 8, 111, 5, 33, 66, 121, 20, 106, 42, - 54, 69, 34, 22, 21, 54, 78, 46, 76, 64, 47, 44, 38, 84, 19, 73, 18, 92, 74, 63, - 65, 40, 34, 12, 6, 127, 32, 90, 62, 47, 42, 72, 121, 128, 44, 77, 121, 23, 105, 95, - 43, 67, 63, 103, 22, 17, 45, 118, 28, 29, 17, 45, 85, 40, 3, 114, 36, 23, 109, 118, - 76, 16, 90, 111, 11, 98, 51, 127, 12, 68, 53, 116, 81, 47, 126, 118, 105, 10, 59, 12, - 101, 72, 114, 34, 19, 82, 68, 115, 12, 119, 123, 66, 21, 32, 106, 110, 49, 50, 20, - 3, 39, 119, 36, 53, 5, 13, 61, 70, 30, 57, 74, 61, 125, 39, 73, 9, 67, 79, 85, - 95, 74, 67, 61, 5, 30, 76, 39, 86, 32, 71, 108, 6, 49, 117, 60, 63, 57, 54, 107, - 126, 104, 57, 59, 120, 68, 6, 108, 81, 113, 126, 64, 36, 60, 123, 117, 13, 68, 8, - 116, 114, 119, 125, 61, 81, 98, 34, 53, 62, 11, 31, 117, 44, 54, 115, 30, 73, 69, 54, - 92, 70, 49, 59, 51, 104, 103, 62, 96, 121, 98, 26, 45, 77, 24, 124, 28, 70, 100, - 2, 98, 47, 25, 100, 37, 42, 115, 105, 42, 127, 65, 24, 102, 122, 33, 79, 87, 22, 47, - 35, 50, 59, 54, 68, 16, 36, 91, 127, 39, 16, 113, 68, 20, 76, 99, 93, 121, 18, - 23, 6, 32, 108, 8, 114, 65, 81, 106, 39, 91, 54, 8, 92, 6, 96, 12, 100, 33, 5, - 105, 50, 89, 70, 33, 40, 85, 39, 93, 119, 26, 97, 90, 18, 74, 11, 105, 114, 84, - 125, 124, 113, 86, 124, 90, 90, 87, 64, 83, 121, 39, 108, 66, 23, 55, 43, 31, - 110, 96, 42, 4, 64, 41, 110, 97, 24, 95, 121, 125, 118, 85, 97, 110, 115, 75, 74, 60, - 115, 47, 80, 55, 67, 92, 127, 120, 8, 42, 5, 50, 55, 35, 117, 60, 106, 127, 77, 58, - 81, 76, 66, 17, 108, 55, 17, 50, 31, 64, 102, 88, 5, 32, 12, 37, 120, 48, 46, 43, 99, - 12, 16, 114, 50, 49, 12, 3, 63, 64, 27, 54, 53, 31, 73, 2, 15, 39, 102, 12, 60, 100, - 27, 28, 24, 46, 101, 10, 104, 51, 127, 101, 60, 55, 114, 25, 3, 29, 20, 53, 108, 7, - 71, 4, 102, 14, 44, 72, 10, 56, 92, 86, 96, 56, 80, 20, 117, 65, 53, 58, 66, 5, - 103, 88, 17, 10, 34, 63, 83, 84, 43, 70, 41, 8, 111, 117, 31, 80, 29, 12, 115, 75, - 84, 91, 91, 10, 91, 26, 40, 30, 36, 44, 12, 18, 83, 29, 19, 15, 123, 98, 118, 26, - 19, 36, 35, 122, 29, 41, 23, 40, 74, 25, 70, 78, 24, 75, 109, 31, 0, 89, 45, - 128, 35, 120, 79, 108, 89, 84, 84, 81, 108, 47, 2, 112, 2, 42, 126, 12, 15, 15, - 109, 109, 97, 76, 126, 5, 23, 66, 65, 1, 39, 102, 121, 127, 24, 21, 68, 42, 49, 69, - 81, 111, 6, 11, 28, 5, 89, 31, 74, 33, 118, 15, 55, 105, 107, 30, 103, 54, 25, - 29, 60, 91, 72, 94, 15, 31, 98, 47, 16, 27, 100, 109, 99, 82, 53, 25, 122, 119, - 96, 65, 4, 24, 50, 79, 40, 65, 6, 91, 125, 7, 80, 103, 88, 22, 107, 38, 39, 100, - 102, 96, 1, 66, 44, 33, 101, 88, 61, 10, 35, 39, 47, 93, 63, 19, 59, 87, 128, 16, 46, - 51, 34, 34, 71, 117, 113, 66, 89, 126, 127, 35, 125, 11, 81, 120, 100, 41, 51, - 85, 30, 82, 68, 86, 114, 77, 56, 125, 10, 2, 95, 75, 31, 33, 84, 83, 22, 35, 99, - 12, 18, 40, 4, 88, 104, 46, 100, 99, 113, 45, 36, 51, 88, 53, 57, 15, 82, 60, 101, 10, - 16, 83, 23, 78, 47, 34, 27, 56, 85, 14, 14, 53, 20, 71, 101, 82, 14, 35, 3, 51, - 91, 16, 46, 117, 108, 30, 120, 124, 22, 89, 57, 119, 50, 91, 52, 77, 7, 10, 79, - 5, 21, 81, 43, 58, 61, 59, 39, 60, 122, 23, 68, 21, 19, 81, 3, 31, 64, 54, 126, 56, - 23, 64, 28, 32, 2, 119, 2, 55, 125, 57, 7, 51, 116, 93, 34, 15, 96, 120, 6, 73, - 100, 98, 53, 116, 22, 64, 63, 112, 19, 60, 77, 95, 32, 3, 2, 117, 41, 80, 96, 122, - 15, 45, 118, 102, 26, 89, 74, 2, 17, 63, 21, 52, 23, 82, 97, 22, 68, 39, 119, - 117, 128, 49, 71, 55, 38, 55, 87, 3, 76, 80, 13, 57, 47, 59, 91, 46, 124, 115, - 7, 74, 95, 26, 128, 86, 16, 20, 107, 117, 10, 72, 35, 30, 128, 75, 113, 45, 116, - 125, 1, 46, 98, 14, 34, 29, 100, 17, 122, 65, 35, 69, 72, 12, 6, 5, 65, 29, 112, - 47, 21, 103, 63, 118, 75, 21, 99, 6, 36, 46, 86, 59, 9, 117, 23, 82, 75, 13, 4, 9, - 104, 43, 73, 17, 111, 36, 60, 38, 120, 99, 114, 117, 110, 27, 100, 104, 63, 87, 53, - 54, 71, 38, 58, 86, 124, 3, 103, 92, 79, 127, 97, 17, 103, 13, 25, 65, 12, 28, 89, - 62, 48, 115, 30, 19, 80, 14, 7, 21, 124, 91, 104, 110, 97, 97, 0, 104, 124, 93, 24, - 70, 13, 99, 91, 73, 55, 84, 25, 22, 111, 115, 58, 45, 97, 8, 39, 125, 9, 22, 91, - 98, 19, 14, 54, 26, 33, 46, 61, 98, 122, 69, 72, 97, 71, 73, 106, 32, 105, 27, 0, 56, - 66, 51, 4, 94, 72, 117, 69]; diff --git a/tests/source/configs-array_horizontal_layout_threshold-1000.rs b/tests/source/configs-array_horizontal_layout_threshold-1000.rs deleted file mode 100644 index c1fb8e92872..00000000000 --- a/tests/source/configs-array_horizontal_layout_threshold-1000.rs +++ /dev/null @@ -1,107 +0,0 @@ -// rustfmt-array_horizontal_layout_threshold: 1000 - -const ARRAY: [u8; 2048] = - [99, 72, 48, 104, 44, 112, 38, 62, 40, 93, 23, 24, 32, 21, 102, 76, 65, 29, 116, - 21, 18, 37, 61, 10, 108, 31, 85, 93, 2, 108, 103, 77, 109, 40, 92, 88, 114, 32, 31, - 87, 69, 42, 38, 25, 105, 6, 61, 128, 45, 6, 43, 81, 7, 3, 1, 125, 24, 123, 2, - 29, 111, 120, 26, 0, 78, 36, 115, 86, 66, 10, 52, 87, 27, 125, 122, 42, 126, 101, - 70, 78, 90, 62, 72, 43, 3, 111, 8, 110, 11, 124, 124, 102, 74, 35, 9, 83, 22, 121, - 34, 70, 69, 52, 31, 92, 94, 67, 21, 76, 65, 10, 79, 54, 17, 58, 105, 13, 96, 61, 99, - 31, 87, 41, 78, 88, 120, 35, 95, 25, 80, 100, 45, 79, 49, 56, 5, 114, 11, 25, 16, 97, - 2, 43, 17, 71, 63, 102, 81, 55, 14, 59, 102, 55, 101, 119, 29, 58, 103, 2, 88, - 85, 9, 70, 91, 73, 37, 70, 123, 15, 68, 50, 76, 52, 46, 126, 87, 44, 85, 3, 97, - 59, 39, 37, 79, 110, 25, 109, 90, 124, 109, 6, 47, 60, 79, 15, 40, 3, 40, 20, 98, - 9, 21, 65, 119, 2, 20, 64, 56, 34, 116, 22, 125, 113, 57, 30, 21, 92, 76, 10, 107, - 61, 8, 124, 110, 87, 64, 99, 26, 122, 56, 127, 94, 8, 121, 19, 24, 27, 61, 34, - 44, 73, 82, 10, 49, 95, 72, 89, 27, 124, 75, 33, 64, 48, 73, 21, 101, 34, 47, - 103, 114, 11, 31, 11, 93, 31, 54, 102, 117, 38, 31, 33, 84, 72, 128, 91, 3, 84, 92, - 48, 69, 39, 97, 113, 70, 26, 96, 107, 117, 76, 59, 50, 43, 66, 21, 90, 31, 102, 45, - 66, 5, 115, 63, 61, 83, 37, 16, 78, 22, 120, 52, 24, 25, 70, 71, 54, 11, 103, 45, - 44, 101, 106, 53, 39, 116, 83, 4, 68, 12, 59, 3, 37, 112, 123, 7, 120, 127, 93, - 34, 101, 48, 114, 127, 65, 69, 16, 79, 125, 18, 71, 69, 72, 54, 60, 107, 52, 18, - 92, 105, 119, 17, 32, 23, 37, 8, 127, 99, 71, 54, 80, 109, 54, 51, 44, 20, 40, - 52, 46, 81, 28, 46, 82, 39, 39, 70, 3, 90, 41, 40, 36, 127, 48, 124, 26, 115, - 47, 93, 104, 4, 70, 88, 3, 4, 34, 75, 46, 16, 65, 114, 53, 51, 123, 16, 36, 98, - 36, 37, 36, 80, 71, 3, 116, 89, 52, 74, 7, 116, 39, 48, 51, 54, 56, 105, 90, 50, 67, - 111, 111, 7, 55, 87, 30, 15, 75, 50, 23, 9, 115, 2, 27, 45, 75, 29, 15, 15, 47, 33, - 119, 85, 11, 116, 127, 53, 37, 3, 0, 116, 77, 4, 37, 56, 8, 92, 105, 86, 101, - 79, 103, 98, 70, 122, 110, 38, 50, 52, 51, 62, 98, 95, 49, 21, 116, 30, 61, 1, - 36, 96, 33, 78, 75, 23, 118, 88, 10, 4, 91, 38, 32, 96, 64, 71, 89, 108, 10, 106, - 62, 86, 104, 24, 117, 2, 72, 99, 60, 117, 109, 67, 112, 124, 111, 102, 4, 126, 95, - 23, 68, 115, 106, 15, 103, 101, 19, 30, 7, 29, 109, 62, 93, 22, 30, 106, 7, 52, 77, - 88, 8, 32, 3, 63, 77, 14, 86, 82, 114, 104, 119, 122, 40, 92, 3, 98, 128, 53, - 74, 40, 1, 94, 5, 112, 59, 29, 128, 119, 33, 67, 42, 109, 30, 93, 40, 113, 13, 85, - 17, 51, 63, 57, 4, 2, 102, 93, 25, 61, 39, 110, 56, 21, 102, 25, 4, 113, 84, 63, - 64, 63, 73, 83, 39, 123, 113, 68, 83, 95, 7, 23, 18, 73, 52, 16, 41, 81, 38, 55, 82, - 59, 93, 6, 30, 25, 65, 67, 44, 99, 18, 77, 74, 62, 126, 36, 110, 66, 4, 86, 123, - 21, 109, 46, 93, 112, 107, 35, 14, 127, 112, 54, 65, 0, 59, 76, 47, 94, 6, 94, 86, - 49, 118, 44, 10, 15, 5, 105, 12, 28, 5, 94, 56, 31, 79, 86, 116, 18, 32, 69, 1, - 83, 36, 38, 71, 38, 71, 23, 71, 9, 30, 64, 2, 6, 21, 112, 55, 1, 43, 126, 33, 79, 97, - 49, 86, 7, 84, 40, 42, 25, 35, 51, 118, 56, 115, 104, 103, 20, 103, 95, 92, 43, - 50, 42, 34, 122, 116, 75, 31, 109, 53, 44, 6, 48, 1, 52, 119, 123, 32, 50, 63, - 114, 105, 16, 79, 53, 19, 78, 86, 110, 4, 43, 97, 3, 18, 110, 84, 70, 23, 84, 23, - 48, 125, 36, 58, 25, 90, 111, 103, 83, 38, 112, 127, 28, 53, 86, 67, 78, 126, 86, - 8, 41, 76, 10, 54, 11, 22, 3, 12, 2, 50, 91, 82, 90, 42, 108, 29, 72, 86, 34, 91, - 115, 46, 86, 28, 46, 22, 97, 104, 48, 8, 22, 92, 10, 71, 102, 52, 116, 65, 15, 102, - 8, 113, 53, 110, 49, 81, 102, 48, 91, 32, 18, 67, 49, 124, 35, 83, 37, 16, 31, 8, - 58, 48, 77, 104, 71, 60, 40, 44, 74, 2, 40, 12, 22, 23, 49, 17, 98, 21, 83, 117, 64, - 115, 44, 4, 46, 70, 47, 115, 24, 66, 71, 80, 59, 32, 46, 81, 118, 8, 29, 93, 86, 81, - 20, 44, 46, 4, 116, 107, 117, 11, 30, 78, 13, 61, 110, 45, 101, 113, 34, 102, 19, 64, - 10, 36, 68, 94, 40, 87, 74, 105, 81, 70, 58, 44, 46, 108, 90, 60, 32, 36, 23, 115, - 40, 97, 43, 58, 16, 120, 74, 52, 42, 49, 16, 62, 122, 97, 107, 15, 104, 13, 17, - 103, 49, 112, 123, 23, 107, 49, 40, 101, 62, 9, 71, 92, 70, 57, 37, 42, 21, 83, 2, - 20, 116, 22, 8, 34, 61, 56, 65, 115, 121, 116, 67, 111, 52, 80, 94, 46, 18, 68, 72, - 3, 61, 96, 127, 46, 7, 90, 100, 31, 30, 80, 123, 72, 74, 115, 74, 81, 45, 79, 121, - 57, 85, 117, 5, 88, 101, 97, 10, 12, 43, 57, 107, 83, 25, 12, 117, 103, 72, 115, 29, - 58, 101, 103, 120, 115, 74, 125, 127, 70, 7, 24, 92, 15, 103, 58, 83, 54, 75, 30, 9, - 111, 68, 53, 29, 25, 19, 96, 38, 93, 123, 126, 63, 115, 92, 119, 76, 50, 7, 9, - 101, 68, 26, 122, 5, 77, 4, 116, 89, 81, 21, 8, 111, 5, 33, 66, 121, 20, 106, 42, - 54, 69, 34, 22, 21, 54, 78, 46, 76, 64, 47, 44, 38, 84, 19, 73, 18, 92, 74, 63, - 65, 40, 34, 12, 6, 127, 32, 90, 62, 47, 42, 72, 121, 128, 44, 77, 121, 23, 105, 95, - 43, 67, 63, 103, 22, 17, 45, 118, 28, 29, 17, 45, 85, 40, 3, 114, 36, 23, 109, 118, - 76, 16, 90, 111, 11, 98, 51, 127, 12, 68, 53, 116, 81, 47, 126, 118, 105, 10, 59, 12, - 101, 72, 114, 34, 19, 82, 68, 115, 12, 119, 123, 66, 21, 32, 106, 110, 49, 50, 20, - 3, 39, 119, 36, 53, 5, 13, 61, 70, 30, 57, 74, 61, 125, 39, 73, 9, 67, 79, 85, - 95, 74, 67, 61, 5, 30, 76, 39, 86, 32, 71, 108, 6, 49, 117, 60, 63, 57, 54, 107, - 126, 104, 57, 59, 120, 68, 6, 108, 81, 113, 126, 64, 36, 60, 123, 117, 13, 68, 8, - 116, 114, 119, 125, 61, 81, 98, 34, 53, 62, 11, 31, 117, 44, 54, 115, 30, 73, 69, 54, - 92, 70, 49, 59, 51, 104, 103, 62, 96, 121, 98, 26, 45, 77, 24, 124, 28, 70, 100, - 2, 98, 47, 25, 100, 37, 42, 115, 105, 42, 127, 65, 24, 102, 122, 33, 79, 87, 22, 47, - 35, 50, 59, 54, 68, 16, 36, 91, 127, 39, 16, 113, 68, 20, 76, 99, 93, 121, 18, - 23, 6, 32, 108, 8, 114, 65, 81, 106, 39, 91, 54, 8, 92, 6, 96, 12, 100, 33, 5, - 105, 50, 89, 70, 33, 40, 85, 39, 93, 119, 26, 97, 90, 18, 74, 11, 105, 114, 84, - 125, 124, 113, 86, 124, 90, 90, 87, 64, 83, 121, 39, 108, 66, 23, 55, 43, 31, - 110, 96, 42, 4, 64, 41, 110, 97, 24, 95, 121, 125, 118, 85, 97, 110, 115, 75, 74, 60, - 115, 47, 80, 55, 67, 92, 127, 120, 8, 42, 5, 50, 55, 35, 117, 60, 106, 127, 77, 58, - 81, 76, 66, 17, 108, 55, 17, 50, 31, 64, 102, 88, 5, 32, 12, 37, 120, 48, 46, 43, 99, - 12, 16, 114, 50, 49, 12, 3, 63, 64, 27, 54, 53, 31, 73, 2, 15, 39, 102, 12, 60, 100, - 27, 28, 24, 46, 101, 10, 104, 51, 127, 101, 60, 55, 114, 25, 3, 29, 20, 53, 108, 7, - 71, 4, 102, 14, 44, 72, 10, 56, 92, 86, 96, 56, 80, 20, 117, 65, 53, 58, 66, 5, - 103, 88, 17, 10, 34, 63, 83, 84, 43, 70, 41, 8, 111, 117, 31, 80, 29, 12, 115, 75, - 84, 91, 91, 10, 91, 26, 40, 30, 36, 44, 12, 18, 83, 29, 19, 15, 123, 98, 118, 26, - 19, 36, 35, 122, 29, 41, 23, 40, 74, 25, 70, 78, 24, 75, 109, 31, 0, 89, 45, - 128, 35, 120, 79, 108, 89, 84, 84, 81, 108, 47, 2, 112, 2, 42, 126, 12, 15, 15, - 109, 109, 97, 76, 126, 5, 23, 66, 65, 1, 39, 102, 121, 127, 24, 21, 68, 42, 49, 69, - 81, 111, 6, 11, 28, 5, 89, 31, 74, 33, 118, 15, 55, 105, 107, 30, 103, 54, 25, - 29, 60, 91, 72, 94, 15, 31, 98, 47, 16, 27, 100, 109, 99, 82, 53, 25, 122, 119, - 96, 65, 4, 24, 50, 79, 40, 65, 6, 91, 125, 7, 80, 103, 88, 22, 107, 38, 39, 100, - 102, 96, 1, 66, 44, 33, 101, 88, 61, 10, 35, 39, 47, 93, 63, 19, 59, 87, 128, 16, 46, - 51, 34, 34, 71, 117, 113, 66, 89, 126, 127, 35, 125, 11, 81, 120, 100, 41, 51, - 85, 30, 82, 68, 86, 114, 77, 56, 125, 10, 2, 95, 75, 31, 33, 84, 83, 22, 35, 99, - 12, 18, 40, 4, 88, 104, 46, 100, 99, 113, 45, 36, 51, 88, 53, 57, 15, 82, 60, 101, 10, - 16, 83, 23, 78, 47, 34, 27, 56, 85, 14, 14, 53, 20, 71, 101, 82, 14, 35, 3, 51, - 91, 16, 46, 117, 108, 30, 120, 124, 22, 89, 57, 119, 50, 91, 52, 77, 7, 10, 79, - 5, 21, 81, 43, 58, 61, 59, 39, 60, 122, 23, 68, 21, 19, 81, 3, 31, 64, 54, 126, 56, - 23, 64, 28, 32, 2, 119, 2, 55, 125, 57, 7, 51, 116, 93, 34, 15, 96, 120, 6, 73, - 100, 98, 53, 116, 22, 64, 63, 112, 19, 60, 77, 95, 32, 3, 2, 117, 41, 80, 96, 122, - 15, 45, 118, 102, 26, 89, 74, 2, 17, 63, 21, 52, 23, 82, 97, 22, 68, 39, 119, - 117, 128, 49, 71, 55, 38, 55, 87, 3, 76, 80, 13, 57, 47, 59, 91, 46, 124, 115, - 7, 74, 95, 26, 128, 86, 16, 20, 107, 117, 10, 72, 35, 30, 128, 75, 113, 45, 116, - 125, 1, 46, 98, 14, 34, 29, 100, 17, 122, 65, 35, 69, 72, 12, 6, 5, 65, 29, 112, - 47, 21, 103, 63, 118, 75, 21, 99, 6, 36, 46, 86, 59, 9, 117, 23, 82, 75, 13, 4, 9, - 104, 43, 73, 17, 111, 36, 60, 38, 120, 99, 114, 117, 110, 27, 100, 104, 63, 87, 53, - 54, 71, 38, 58, 86, 124, 3, 103, 92, 79, 127, 97, 17, 103, 13, 25, 65, 12, 28, 89, - 62, 48, 115, 30, 19, 80, 14, 7, 21, 124, 91, 104, 110, 97, 97, 0, 104, 124, 93, 24, - 70, 13, 99, 91, 73, 55, 84, 25, 22, 111, 115, 58, 45, 97, 8, 39, 125, 9, 22, 91, - 98, 19, 14, 54, 26, 33, 46, 61, 98, 122, 69, 72, 97, 71, 73, 106, 32, 105, 27, 0, 56, - 66, 51, 4, 94, 72, 117, 69]; diff --git a/tests/source/configs-array_width-above.rs b/tests/source/configs-array_width-above.rs deleted file mode 100644 index 020a984438e..00000000000 --- a/tests/source/configs-array_width-above.rs +++ /dev/null @@ -1,6 +0,0 @@ -// rustfmt-array_width: 10 -// Array width - -fn main() { - let lorem = vec!["ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing", "elit"]; -} diff --git a/tests/source/configs-array_width-below.rs b/tests/source/configs-array_width-below.rs deleted file mode 100644 index d76d539773a..00000000000 --- a/tests/source/configs-array_width-below.rs +++ /dev/null @@ -1,6 +0,0 @@ -// rustfmt-array_width: 100 -// Array width - -fn main() { - let lorem = vec!["ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing", "elit"]; -} diff --git a/tests/source/configs-chain_width-above.rs b/tests/source/configs-chain_width-above.rs deleted file mode 100644 index d26505b8628..00000000000 --- a/tests/source/configs-chain_width-above.rs +++ /dev/null @@ -1,6 +0,0 @@ -// rustfmt-chain_width: 10 -// Chain one line max - -fn main() { - let lorem = ipsum.dolor().sit().amet().consectetur().adipiscing().elit(); -} diff --git a/tests/source/configs-chain_width-below.rs b/tests/source/configs-chain_width-below.rs deleted file mode 100644 index d877deb74eb..00000000000 --- a/tests/source/configs-chain_width-below.rs +++ /dev/null @@ -1,6 +0,0 @@ -// rustfmt-chain_width: 100 -// Chain one line max - -fn main() { - let lorem = ipsum.dolor().sit().amet().consectetur().adipiscing().elit(); -} diff --git a/tests/source/configs-fn_call_width-above.rs b/tests/source/configs-fn_call_width-above.rs deleted file mode 100644 index 237e72c3034..00000000000 --- a/tests/source/configs-fn_call_width-above.rs +++ /dev/null @@ -1,6 +0,0 @@ -// rustfmt-fn_call_width: 10 -// Function call width - -fn main() { - lorem("lorem", "ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing", "elit"); -} diff --git a/tests/source/configs-fn_call_width-below.rs b/tests/source/configs-fn_call_width-below.rs deleted file mode 100644 index b79918f5b98..00000000000 --- a/tests/source/configs-fn_call_width-below.rs +++ /dev/null @@ -1,6 +0,0 @@ -// rustfmt-fn_call_width: 100 -// Function call width - -fn main() { - lorem("lorem", "ipsum", "dolor"); -} diff --git a/tests/source/configs-fn_call_width-zero.rs b/tests/source/configs-fn_call_width-zero.rs deleted file mode 100644 index e7db3261556..00000000000 --- a/tests/source/configs-fn_call_width-zero.rs +++ /dev/null @@ -1,7 +0,0 @@ -// rustfmt-fn_call_width: 0 -// rustfmt-indent_style: block - -// #1508 -fn a() { - let x = f(y); -} diff --git a/tests/source/configs-single_line_if_else_max_width-above.rs b/tests/source/configs-single_line_if_else_max_width-above.rs deleted file mode 100644 index 698fa8bc460..00000000000 --- a/tests/source/configs-single_line_if_else_max_width-above.rs +++ /dev/null @@ -1,6 +0,0 @@ -// rustfmt-single_line_if_else_max_width: 10 -// Single line if-else max width - -fn main() { - let lorem = if ipsum { dolor } else { sit }; -} diff --git a/tests/source/configs-single_line_if_else_max_width-below.rs b/tests/source/configs-single_line_if_else_max_width-below.rs deleted file mode 100644 index efafa6c4498..00000000000 --- a/tests/source/configs-single_line_if_else_max_width-below.rs +++ /dev/null @@ -1,6 +0,0 @@ -// rustfmt-single_line_if_else_max_width: 100 -// Single line if-else max width - -fn main() { - let lorem = if ipsum { dolor } else { sit }; -} diff --git a/tests/source/configs-struct_lit_single_line-true.rs b/tests/source/configs-struct_lit_single_line-true.rs deleted file mode 100644 index 363bf5b114e..00000000000 --- a/tests/source/configs-struct_lit_single_line-true.rs +++ /dev/null @@ -1,7 +0,0 @@ -// rustfmt-struct_lit_single_line: true -// rustfmt-struct_lit_width: 100 -// Struct literal multiline-style - -fn main() { - let lorem = Lorem { ipsum: dolor, sit: amet }; -} diff --git a/tests/source/configs-struct_lit_width-above.rs b/tests/source/configs-struct_lit_width-above.rs deleted file mode 100644 index 123fa59f90e..00000000000 --- a/tests/source/configs-struct_lit_width-above.rs +++ /dev/null @@ -1,6 +0,0 @@ -// rustfmt-struct_lit_width: 10 -// Struct literal-style - -fn main() { - let lorem = Lorem { ipsum: dolor, sit: amet }; -} diff --git a/tests/source/configs-struct_lit_width-below.rs b/tests/source/configs-struct_lit_width-below.rs deleted file mode 100644 index 7ffe4a32eaf..00000000000 --- a/tests/source/configs-struct_lit_width-below.rs +++ /dev/null @@ -1,6 +0,0 @@ -// rustfmt-struct_lit_width: 100 -// Struct literal-style - -fn main() { - let lorem = Lorem { ipsum: dolor, sit: amet }; -} diff --git a/tests/source/configs-struct_variant_width-above.rs b/tests/source/configs-struct_variant_width-above.rs deleted file mode 100644 index 13ceed0bc63..00000000000 --- a/tests/source/configs-struct_variant_width-above.rs +++ /dev/null @@ -1,8 +0,0 @@ -// rustfmt-struct_variant_width: 10 -// Struct variant width - -enum Lorem { - Ipsum, - Dolor(bool), - Sit { amet: Consectetur, adipiscing: Elit, }, -} diff --git a/tests/source/configs-struct_variant_width-below.rs b/tests/source/configs-struct_variant_width-below.rs deleted file mode 100644 index a16a57e19b8..00000000000 --- a/tests/source/configs-struct_variant_width-below.rs +++ /dev/null @@ -1,8 +0,0 @@ -// rustfmt-struct_variant_width: 100 -// Struct variant width - -enum Lorem { - Ipsum, - Dolor(bool), - Sit { amet: Consectetur, adipiscing: Elit }, -} diff --git a/tests/source/else-if-brace-style-always-next-line.rs b/tests/source/else-if-brace-style-always-next-line.rs index 12208dd7c8b..7b4870fc65a 100644 --- a/tests/source/else-if-brace-style-always-next-line.rs +++ b/tests/source/else-if-brace-style-always-next-line.rs @@ -1,4 +1,3 @@ -// rustfmt-single_line_if_else_max_width: 0 // rustfmt-control_brace_style: AlwaysNextLine fn main() { diff --git a/tests/source/else-if-brace-style-always-same-line.rs b/tests/source/else-if-brace-style-always-same-line.rs index c844275ef5b..41f5305bf8c 100644 --- a/tests/source/else-if-brace-style-always-same-line.rs +++ b/tests/source/else-if-brace-style-always-same-line.rs @@ -1,4 +1,3 @@ -// rustfmt-single_line_if_else_max_width: 0 // rustfmt-control_brace_style: AlwaysSameLine fn main() { diff --git a/tests/source/else-if-brace-style-closing-next-line.rs b/tests/source/else-if-brace-style-closing-next-line.rs index ccc8d7b0f3f..3b885b3faaa 100644 --- a/tests/source/else-if-brace-style-closing-next-line.rs +++ b/tests/source/else-if-brace-style-closing-next-line.rs @@ -1,4 +1,3 @@ -// rustfmt-single_line_if_else_max_width: 0 // rustfmt-control_brace_style: ClosingNextLine fn main() { diff --git a/tests/source/hard-tabs.rs b/tests/source/hard-tabs.rs index a7173897b0d..f598ad881d0 100644 --- a/tests/source/hard-tabs.rs +++ b/tests/source/hard-tabs.rs @@ -1,5 +1,4 @@ // rustfmt-normalize_comments: true -// rustfmt-single_line_if_else_max_width: 0 // rustfmt-wrap_comments: true // rustfmt-hard_tabs: true // rustfmt-error_on_line_overflow: false diff --git a/tests/source/single-line-if-else.rs b/tests/source/single-line-if-else.rs index 3780ef7659f..bcde390d116 100644 --- a/tests/source/single-line-if-else.rs +++ b/tests/source/single-line-if-else.rs @@ -1,4 +1,3 @@ -// rustfmt-single_line_if_else_max_width: 100 // Format if-else expressions on a single line, when possible. diff --git a/tests/target/chains-visual.rs b/tests/target/chains-visual.rs index 9533e2f04b1..abb81d8119c 100644 --- a/tests/target/chains-visual.rs +++ b/tests/target/chains-visual.rs @@ -1,5 +1,4 @@ // rustfmt-normalize_comments: true -// rustfmt-single_line_if_else_max_width: 0 // rustfmt-indent_style: Visual // Test chain formatting. @@ -21,11 +20,7 @@ fn main() { false => (), }); - loong_func().quux(move || if true { - 1 - } else { - 2 - }); + loong_func().quux(move || if true { 1 } else { 2 }); some_fuuuuuuuuunction().method_call_a(aaaaa, bbbbb, |c| { let x = c; @@ -67,11 +62,7 @@ fn floaters() { field2: val2, }.method_call() .method_call(); - let y = if cond { - val1 - } else { - val2 - }.method_call(); + let y = if cond { val1 } else { val2 }.method_call(); { match x { diff --git a/tests/target/chains.rs b/tests/target/chains.rs index 48691b3b6c9..00855de4f98 100644 --- a/tests/target/chains.rs +++ b/tests/target/chains.rs @@ -1,6 +1,5 @@ // rustfmt-normalize_comments: true -// rustfmt-single_line_if_else_max_width: 0 -// rustfmt-chain_width: 100 +// rustfmt-use_small_heuristics: false // Test chain formatting. fn main() { @@ -102,11 +101,12 @@ fn floaters() { }.bar() .baz(); - Foo { x: val } - .baz(|| { - force(); - multiline(); - }) + Foo { + x: val, + }.baz(|| { + force(); + multiline(); + }) .quux(); Foo { @@ -152,9 +152,7 @@ fn try_shorthand() { .0 .x; - parameterized(f, substs, def_id, Ns::Value, &[], |tcx| { - tcx.lookup_item_type(def_id).generics - })?; + parameterized(f, substs, def_id, Ns::Value, &[], |tcx| tcx.lookup_item_type(def_id).generics)?; fooooooooooooooooooooooooooo()? .bar()? .baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaz()?; diff --git a/tests/target/configs-array_horizontal_layout_threshold-1000-visual.rs b/tests/target/configs-array_horizontal_layout_threshold-1000-visual.rs deleted file mode 100644 index 78a3c828c5d..00000000000 --- a/tests/target/configs-array_horizontal_layout_threshold-1000-visual.rs +++ /dev/null @@ -1,96 +0,0 @@ -// rustfmt-array_horizontal_layout_threshold: 1000 -// rustfmt-indent_style: Visual - -const ARRAY: [u8; 2048] = - [99, 72, 48, 104, 44, 112, 38, 62, 40, 93, 23, 24, 32, 21, 102, 76, 65, 29, 116, 21, 18, 37, - 61, 10, 108, 31, 85, 93, 2, 108, 103, 77, 109, 40, 92, 88, 114, 32, 31, 87, 69, 42, 38, 25, - 105, 6, 61, 128, 45, 6, 43, 81, 7, 3, 1, 125, 24, 123, 2, 29, 111, 120, 26, 0, 78, 36, 115, - 86, 66, 10, 52, 87, 27, 125, 122, 42, 126, 101, 70, 78, 90, 62, 72, 43, 3, 111, 8, 110, 11, - 124, 124, 102, 74, 35, 9, 83, 22, 121, 34, 70, 69, 52, 31, 92, 94, 67, 21, 76, 65, 10, 79, - 54, 17, 58, 105, 13, 96, 61, 99, 31, 87, 41, 78, 88, 120, 35, 95, 25, 80, 100, 45, 79, 49, - 56, 5, 114, 11, 25, 16, 97, 2, 43, 17, 71, 63, 102, 81, 55, 14, 59, 102, 55, 101, 119, 29, - 58, 103, 2, 88, 85, 9, 70, 91, 73, 37, 70, 123, 15, 68, 50, 76, 52, 46, 126, 87, 44, 85, 3, - 97, 59, 39, 37, 79, 110, 25, 109, 90, 124, 109, 6, 47, 60, 79, 15, 40, 3, 40, 20, 98, 9, 21, - 65, 119, 2, 20, 64, 56, 34, 116, 22, 125, 113, 57, 30, 21, 92, 76, 10, 107, 61, 8, 124, 110, - 87, 64, 99, 26, 122, 56, 127, 94, 8, 121, 19, 24, 27, 61, 34, 44, 73, 82, 10, 49, 95, 72, 89, - 27, 124, 75, 33, 64, 48, 73, 21, 101, 34, 47, 103, 114, 11, 31, 11, 93, 31, 54, 102, 117, 38, - 31, 33, 84, 72, 128, 91, 3, 84, 92, 48, 69, 39, 97, 113, 70, 26, 96, 107, 117, 76, 59, 50, - 43, 66, 21, 90, 31, 102, 45, 66, 5, 115, 63, 61, 83, 37, 16, 78, 22, 120, 52, 24, 25, 70, 71, - 54, 11, 103, 45, 44, 101, 106, 53, 39, 116, 83, 4, 68, 12, 59, 3, 37, 112, 123, 7, 120, 127, - 93, 34, 101, 48, 114, 127, 65, 69, 16, 79, 125, 18, 71, 69, 72, 54, 60, 107, 52, 18, 92, 105, - 119, 17, 32, 23, 37, 8, 127, 99, 71, 54, 80, 109, 54, 51, 44, 20, 40, 52, 46, 81, 28, 46, 82, - 39, 39, 70, 3, 90, 41, 40, 36, 127, 48, 124, 26, 115, 47, 93, 104, 4, 70, 88, 3, 4, 34, 75, - 46, 16, 65, 114, 53, 51, 123, 16, 36, 98, 36, 37, 36, 80, 71, 3, 116, 89, 52, 74, 7, 116, 39, - 48, 51, 54, 56, 105, 90, 50, 67, 111, 111, 7, 55, 87, 30, 15, 75, 50, 23, 9, 115, 2, 27, 45, - 75, 29, 15, 15, 47, 33, 119, 85, 11, 116, 127, 53, 37, 3, 0, 116, 77, 4, 37, 56, 8, 92, 105, - 86, 101, 79, 103, 98, 70, 122, 110, 38, 50, 52, 51, 62, 98, 95, 49, 21, 116, 30, 61, 1, 36, - 96, 33, 78, 75, 23, 118, 88, 10, 4, 91, 38, 32, 96, 64, 71, 89, 108, 10, 106, 62, 86, 104, - 24, 117, 2, 72, 99, 60, 117, 109, 67, 112, 124, 111, 102, 4, 126, 95, 23, 68, 115, 106, 15, - 103, 101, 19, 30, 7, 29, 109, 62, 93, 22, 30, 106, 7, 52, 77, 88, 8, 32, 3, 63, 77, 14, 86, - 82, 114, 104, 119, 122, 40, 92, 3, 98, 128, 53, 74, 40, 1, 94, 5, 112, 59, 29, 128, 119, 33, - 67, 42, 109, 30, 93, 40, 113, 13, 85, 17, 51, 63, 57, 4, 2, 102, 93, 25, 61, 39, 110, 56, 21, - 102, 25, 4, 113, 84, 63, 64, 63, 73, 83, 39, 123, 113, 68, 83, 95, 7, 23, 18, 73, 52, 16, 41, - 81, 38, 55, 82, 59, 93, 6, 30, 25, 65, 67, 44, 99, 18, 77, 74, 62, 126, 36, 110, 66, 4, 86, - 123, 21, 109, 46, 93, 112, 107, 35, 14, 127, 112, 54, 65, 0, 59, 76, 47, 94, 6, 94, 86, 49, - 118, 44, 10, 15, 5, 105, 12, 28, 5, 94, 56, 31, 79, 86, 116, 18, 32, 69, 1, 83, 36, 38, 71, - 38, 71, 23, 71, 9, 30, 64, 2, 6, 21, 112, 55, 1, 43, 126, 33, 79, 97, 49, 86, 7, 84, 40, 42, - 25, 35, 51, 118, 56, 115, 104, 103, 20, 103, 95, 92, 43, 50, 42, 34, 122, 116, 75, 31, 109, - 53, 44, 6, 48, 1, 52, 119, 123, 32, 50, 63, 114, 105, 16, 79, 53, 19, 78, 86, 110, 4, 43, 97, - 3, 18, 110, 84, 70, 23, 84, 23, 48, 125, 36, 58, 25, 90, 111, 103, 83, 38, 112, 127, 28, 53, - 86, 67, 78, 126, 86, 8, 41, 76, 10, 54, 11, 22, 3, 12, 2, 50, 91, 82, 90, 42, 108, 29, 72, - 86, 34, 91, 115, 46, 86, 28, 46, 22, 97, 104, 48, 8, 22, 92, 10, 71, 102, 52, 116, 65, 15, - 102, 8, 113, 53, 110, 49, 81, 102, 48, 91, 32, 18, 67, 49, 124, 35, 83, 37, 16, 31, 8, 58, - 48, 77, 104, 71, 60, 40, 44, 74, 2, 40, 12, 22, 23, 49, 17, 98, 21, 83, 117, 64, 115, 44, 4, - 46, 70, 47, 115, 24, 66, 71, 80, 59, 32, 46, 81, 118, 8, 29, 93, 86, 81, 20, 44, 46, 4, 116, - 107, 117, 11, 30, 78, 13, 61, 110, 45, 101, 113, 34, 102, 19, 64, 10, 36, 68, 94, 40, 87, 74, - 105, 81, 70, 58, 44, 46, 108, 90, 60, 32, 36, 23, 115, 40, 97, 43, 58, 16, 120, 74, 52, 42, - 49, 16, 62, 122, 97, 107, 15, 104, 13, 17, 103, 49, 112, 123, 23, 107, 49, 40, 101, 62, 9, - 71, 92, 70, 57, 37, 42, 21, 83, 2, 20, 116, 22, 8, 34, 61, 56, 65, 115, 121, 116, 67, 111, - 52, 80, 94, 46, 18, 68, 72, 3, 61, 96, 127, 46, 7, 90, 100, 31, 30, 80, 123, 72, 74, 115, 74, - 81, 45, 79, 121, 57, 85, 117, 5, 88, 101, 97, 10, 12, 43, 57, 107, 83, 25, 12, 117, 103, 72, - 115, 29, 58, 101, 103, 120, 115, 74, 125, 127, 70, 7, 24, 92, 15, 103, 58, 83, 54, 75, 30, 9, - 111, 68, 53, 29, 25, 19, 96, 38, 93, 123, 126, 63, 115, 92, 119, 76, 50, 7, 9, 101, 68, 26, - 122, 5, 77, 4, 116, 89, 81, 21, 8, 111, 5, 33, 66, 121, 20, 106, 42, 54, 69, 34, 22, 21, 54, - 78, 46, 76, 64, 47, 44, 38, 84, 19, 73, 18, 92, 74, 63, 65, 40, 34, 12, 6, 127, 32, 90, 62, - 47, 42, 72, 121, 128, 44, 77, 121, 23, 105, 95, 43, 67, 63, 103, 22, 17, 45, 118, 28, 29, 17, - 45, 85, 40, 3, 114, 36, 23, 109, 118, 76, 16, 90, 111, 11, 98, 51, 127, 12, 68, 53, 116, 81, - 47, 126, 118, 105, 10, 59, 12, 101, 72, 114, 34, 19, 82, 68, 115, 12, 119, 123, 66, 21, 32, - 106, 110, 49, 50, 20, 3, 39, 119, 36, 53, 5, 13, 61, 70, 30, 57, 74, 61, 125, 39, 73, 9, 67, - 79, 85, 95, 74, 67, 61, 5, 30, 76, 39, 86, 32, 71, 108, 6, 49, 117, 60, 63, 57, 54, 107, 126, - 104, 57, 59, 120, 68, 6, 108, 81, 113, 126, 64, 36, 60, 123, 117, 13, 68, 8, 116, 114, 119, - 125, 61, 81, 98, 34, 53, 62, 11, 31, 117, 44, 54, 115, 30, 73, 69, 54, 92, 70, 49, 59, 51, - 104, 103, 62, 96, 121, 98, 26, 45, 77, 24, 124, 28, 70, 100, 2, 98, 47, 25, 100, 37, 42, 115, - 105, 42, 127, 65, 24, 102, 122, 33, 79, 87, 22, 47, 35, 50, 59, 54, 68, 16, 36, 91, 127, 39, - 16, 113, 68, 20, 76, 99, 93, 121, 18, 23, 6, 32, 108, 8, 114, 65, 81, 106, 39, 91, 54, 8, 92, - 6, 96, 12, 100, 33, 5, 105, 50, 89, 70, 33, 40, 85, 39, 93, 119, 26, 97, 90, 18, 74, 11, 105, - 114, 84, 125, 124, 113, 86, 124, 90, 90, 87, 64, 83, 121, 39, 108, 66, 23, 55, 43, 31, 110, - 96, 42, 4, 64, 41, 110, 97, 24, 95, 121, 125, 118, 85, 97, 110, 115, 75, 74, 60, 115, 47, 80, - 55, 67, 92, 127, 120, 8, 42, 5, 50, 55, 35, 117, 60, 106, 127, 77, 58, 81, 76, 66, 17, 108, - 55, 17, 50, 31, 64, 102, 88, 5, 32, 12, 37, 120, 48, 46, 43, 99, 12, 16, 114, 50, 49, 12, 3, - 63, 64, 27, 54, 53, 31, 73, 2, 15, 39, 102, 12, 60, 100, 27, 28, 24, 46, 101, 10, 104, 51, - 127, 101, 60, 55, 114, 25, 3, 29, 20, 53, 108, 7, 71, 4, 102, 14, 44, 72, 10, 56, 92, 86, 96, - 56, 80, 20, 117, 65, 53, 58, 66, 5, 103, 88, 17, 10, 34, 63, 83, 84, 43, 70, 41, 8, 111, 117, - 31, 80, 29, 12, 115, 75, 84, 91, 91, 10, 91, 26, 40, 30, 36, 44, 12, 18, 83, 29, 19, 15, 123, - 98, 118, 26, 19, 36, 35, 122, 29, 41, 23, 40, 74, 25, 70, 78, 24, 75, 109, 31, 0, 89, 45, - 128, 35, 120, 79, 108, 89, 84, 84, 81, 108, 47, 2, 112, 2, 42, 126, 12, 15, 15, 109, 109, 97, - 76, 126, 5, 23, 66, 65, 1, 39, 102, 121, 127, 24, 21, 68, 42, 49, 69, 81, 111, 6, 11, 28, 5, - 89, 31, 74, 33, 118, 15, 55, 105, 107, 30, 103, 54, 25, 29, 60, 91, 72, 94, 15, 31, 98, 47, - 16, 27, 100, 109, 99, 82, 53, 25, 122, 119, 96, 65, 4, 24, 50, 79, 40, 65, 6, 91, 125, 7, 80, - 103, 88, 22, 107, 38, 39, 100, 102, 96, 1, 66, 44, 33, 101, 88, 61, 10, 35, 39, 47, 93, 63, - 19, 59, 87, 128, 16, 46, 51, 34, 34, 71, 117, 113, 66, 89, 126, 127, 35, 125, 11, 81, 120, - 100, 41, 51, 85, 30, 82, 68, 86, 114, 77, 56, 125, 10, 2, 95, 75, 31, 33, 84, 83, 22, 35, 99, - 12, 18, 40, 4, 88, 104, 46, 100, 99, 113, 45, 36, 51, 88, 53, 57, 15, 82, 60, 101, 10, 16, - 83, 23, 78, 47, 34, 27, 56, 85, 14, 14, 53, 20, 71, 101, 82, 14, 35, 3, 51, 91, 16, 46, 117, - 108, 30, 120, 124, 22, 89, 57, 119, 50, 91, 52, 77, 7, 10, 79, 5, 21, 81, 43, 58, 61, 59, 39, - 60, 122, 23, 68, 21, 19, 81, 3, 31, 64, 54, 126, 56, 23, 64, 28, 32, 2, 119, 2, 55, 125, 57, - 7, 51, 116, 93, 34, 15, 96, 120, 6, 73, 100, 98, 53, 116, 22, 64, 63, 112, 19, 60, 77, 95, - 32, 3, 2, 117, 41, 80, 96, 122, 15, 45, 118, 102, 26, 89, 74, 2, 17, 63, 21, 52, 23, 82, 97, - 22, 68, 39, 119, 117, 128, 49, 71, 55, 38, 55, 87, 3, 76, 80, 13, 57, 47, 59, 91, 46, 124, - 115, 7, 74, 95, 26, 128, 86, 16, 20, 107, 117, 10, 72, 35, 30, 128, 75, 113, 45, 116, 125, 1, - 46, 98, 14, 34, 29, 100, 17, 122, 65, 35, 69, 72, 12, 6, 5, 65, 29, 112, 47, 21, 103, 63, - 118, 75, 21, 99, 6, 36, 46, 86, 59, 9, 117, 23, 82, 75, 13, 4, 9, 104, 43, 73, 17, 111, 36, - 60, 38, 120, 99, 114, 117, 110, 27, 100, 104, 63, 87, 53, 54, 71, 38, 58, 86, 124, 3, 103, - 92, 79, 127, 97, 17, 103, 13, 25, 65, 12, 28, 89, 62, 48, 115, 30, 19, 80, 14, 7, 21, 124, - 91, 104, 110, 97, 97, 0, 104, 124, 93, 24, 70, 13, 99, 91, 73, 55, 84, 25, 22, 111, 115, 58, - 45, 97, 8, 39, 125, 9, 22, 91, 98, 19, 14, 54, 26, 33, 46, 61, 98, 122, 69, 72, 97, 71, 73, - 106, 32, 105, 27, 0, 56, 66, 51, 4, 94, 72, 117, 69]; diff --git a/tests/target/configs-array_horizontal_layout_threshold-1000.rs b/tests/target/configs-array_horizontal_layout_threshold-1000.rs deleted file mode 100644 index 7c4347f9519..00000000000 --- a/tests/target/configs-array_horizontal_layout_threshold-1000.rs +++ /dev/null @@ -1,94 +0,0 @@ -// rustfmt-array_horizontal_layout_threshold: 1000 - -const ARRAY: [u8; 2048] = [ - 99, 72, 48, 104, 44, 112, 38, 62, 40, 93, 23, 24, 32, 21, 102, 76, 65, 29, 116, 21, 18, 37, 61, - 10, 108, 31, 85, 93, 2, 108, 103, 77, 109, 40, 92, 88, 114, 32, 31, 87, 69, 42, 38, 25, 105, 6, - 61, 128, 45, 6, 43, 81, 7, 3, 1, 125, 24, 123, 2, 29, 111, 120, 26, 0, 78, 36, 115, 86, 66, 10, - 52, 87, 27, 125, 122, 42, 126, 101, 70, 78, 90, 62, 72, 43, 3, 111, 8, 110, 11, 124, 124, 102, - 74, 35, 9, 83, 22, 121, 34, 70, 69, 52, 31, 92, 94, 67, 21, 76, 65, 10, 79, 54, 17, 58, 105, - 13, 96, 61, 99, 31, 87, 41, 78, 88, 120, 35, 95, 25, 80, 100, 45, 79, 49, 56, 5, 114, 11, 25, - 16, 97, 2, 43, 17, 71, 63, 102, 81, 55, 14, 59, 102, 55, 101, 119, 29, 58, 103, 2, 88, 85, 9, - 70, 91, 73, 37, 70, 123, 15, 68, 50, 76, 52, 46, 126, 87, 44, 85, 3, 97, 59, 39, 37, 79, 110, - 25, 109, 90, 124, 109, 6, 47, 60, 79, 15, 40, 3, 40, 20, 98, 9, 21, 65, 119, 2, 20, 64, 56, 34, - 116, 22, 125, 113, 57, 30, 21, 92, 76, 10, 107, 61, 8, 124, 110, 87, 64, 99, 26, 122, 56, 127, - 94, 8, 121, 19, 24, 27, 61, 34, 44, 73, 82, 10, 49, 95, 72, 89, 27, 124, 75, 33, 64, 48, 73, - 21, 101, 34, 47, 103, 114, 11, 31, 11, 93, 31, 54, 102, 117, 38, 31, 33, 84, 72, 128, 91, 3, - 84, 92, 48, 69, 39, 97, 113, 70, 26, 96, 107, 117, 76, 59, 50, 43, 66, 21, 90, 31, 102, 45, 66, - 5, 115, 63, 61, 83, 37, 16, 78, 22, 120, 52, 24, 25, 70, 71, 54, 11, 103, 45, 44, 101, 106, 53, - 39, 116, 83, 4, 68, 12, 59, 3, 37, 112, 123, 7, 120, 127, 93, 34, 101, 48, 114, 127, 65, 69, - 16, 79, 125, 18, 71, 69, 72, 54, 60, 107, 52, 18, 92, 105, 119, 17, 32, 23, 37, 8, 127, 99, 71, - 54, 80, 109, 54, 51, 44, 20, 40, 52, 46, 81, 28, 46, 82, 39, 39, 70, 3, 90, 41, 40, 36, 127, - 48, 124, 26, 115, 47, 93, 104, 4, 70, 88, 3, 4, 34, 75, 46, 16, 65, 114, 53, 51, 123, 16, 36, - 98, 36, 37, 36, 80, 71, 3, 116, 89, 52, 74, 7, 116, 39, 48, 51, 54, 56, 105, 90, 50, 67, 111, - 111, 7, 55, 87, 30, 15, 75, 50, 23, 9, 115, 2, 27, 45, 75, 29, 15, 15, 47, 33, 119, 85, 11, - 116, 127, 53, 37, 3, 0, 116, 77, 4, 37, 56, 8, 92, 105, 86, 101, 79, 103, 98, 70, 122, 110, 38, - 50, 52, 51, 62, 98, 95, 49, 21, 116, 30, 61, 1, 36, 96, 33, 78, 75, 23, 118, 88, 10, 4, 91, 38, - 32, 96, 64, 71, 89, 108, 10, 106, 62, 86, 104, 24, 117, 2, 72, 99, 60, 117, 109, 67, 112, 124, - 111, 102, 4, 126, 95, 23, 68, 115, 106, 15, 103, 101, 19, 30, 7, 29, 109, 62, 93, 22, 30, 106, - 7, 52, 77, 88, 8, 32, 3, 63, 77, 14, 86, 82, 114, 104, 119, 122, 40, 92, 3, 98, 128, 53, 74, - 40, 1, 94, 5, 112, 59, 29, 128, 119, 33, 67, 42, 109, 30, 93, 40, 113, 13, 85, 17, 51, 63, 57, - 4, 2, 102, 93, 25, 61, 39, 110, 56, 21, 102, 25, 4, 113, 84, 63, 64, 63, 73, 83, 39, 123, 113, - 68, 83, 95, 7, 23, 18, 73, 52, 16, 41, 81, 38, 55, 82, 59, 93, 6, 30, 25, 65, 67, 44, 99, 18, - 77, 74, 62, 126, 36, 110, 66, 4, 86, 123, 21, 109, 46, 93, 112, 107, 35, 14, 127, 112, 54, 65, - 0, 59, 76, 47, 94, 6, 94, 86, 49, 118, 44, 10, 15, 5, 105, 12, 28, 5, 94, 56, 31, 79, 86, 116, - 18, 32, 69, 1, 83, 36, 38, 71, 38, 71, 23, 71, 9, 30, 64, 2, 6, 21, 112, 55, 1, 43, 126, 33, - 79, 97, 49, 86, 7, 84, 40, 42, 25, 35, 51, 118, 56, 115, 104, 103, 20, 103, 95, 92, 43, 50, 42, - 34, 122, 116, 75, 31, 109, 53, 44, 6, 48, 1, 52, 119, 123, 32, 50, 63, 114, 105, 16, 79, 53, - 19, 78, 86, 110, 4, 43, 97, 3, 18, 110, 84, 70, 23, 84, 23, 48, 125, 36, 58, 25, 90, 111, 103, - 83, 38, 112, 127, 28, 53, 86, 67, 78, 126, 86, 8, 41, 76, 10, 54, 11, 22, 3, 12, 2, 50, 91, 82, - 90, 42, 108, 29, 72, 86, 34, 91, 115, 46, 86, 28, 46, 22, 97, 104, 48, 8, 22, 92, 10, 71, 102, - 52, 116, 65, 15, 102, 8, 113, 53, 110, 49, 81, 102, 48, 91, 32, 18, 67, 49, 124, 35, 83, 37, - 16, 31, 8, 58, 48, 77, 104, 71, 60, 40, 44, 74, 2, 40, 12, 22, 23, 49, 17, 98, 21, 83, 117, 64, - 115, 44, 4, 46, 70, 47, 115, 24, 66, 71, 80, 59, 32, 46, 81, 118, 8, 29, 93, 86, 81, 20, 44, - 46, 4, 116, 107, 117, 11, 30, 78, 13, 61, 110, 45, 101, 113, 34, 102, 19, 64, 10, 36, 68, 94, - 40, 87, 74, 105, 81, 70, 58, 44, 46, 108, 90, 60, 32, 36, 23, 115, 40, 97, 43, 58, 16, 120, 74, - 52, 42, 49, 16, 62, 122, 97, 107, 15, 104, 13, 17, 103, 49, 112, 123, 23, 107, 49, 40, 101, 62, - 9, 71, 92, 70, 57, 37, 42, 21, 83, 2, 20, 116, 22, 8, 34, 61, 56, 65, 115, 121, 116, 67, 111, - 52, 80, 94, 46, 18, 68, 72, 3, 61, 96, 127, 46, 7, 90, 100, 31, 30, 80, 123, 72, 74, 115, 74, - 81, 45, 79, 121, 57, 85, 117, 5, 88, 101, 97, 10, 12, 43, 57, 107, 83, 25, 12, 117, 103, 72, - 115, 29, 58, 101, 103, 120, 115, 74, 125, 127, 70, 7, 24, 92, 15, 103, 58, 83, 54, 75, 30, 9, - 111, 68, 53, 29, 25, 19, 96, 38, 93, 123, 126, 63, 115, 92, 119, 76, 50, 7, 9, 101, 68, 26, - 122, 5, 77, 4, 116, 89, 81, 21, 8, 111, 5, 33, 66, 121, 20, 106, 42, 54, 69, 34, 22, 21, 54, - 78, 46, 76, 64, 47, 44, 38, 84, 19, 73, 18, 92, 74, 63, 65, 40, 34, 12, 6, 127, 32, 90, 62, 47, - 42, 72, 121, 128, 44, 77, 121, 23, 105, 95, 43, 67, 63, 103, 22, 17, 45, 118, 28, 29, 17, 45, - 85, 40, 3, 114, 36, 23, 109, 118, 76, 16, 90, 111, 11, 98, 51, 127, 12, 68, 53, 116, 81, 47, - 126, 118, 105, 10, 59, 12, 101, 72, 114, 34, 19, 82, 68, 115, 12, 119, 123, 66, 21, 32, 106, - 110, 49, 50, 20, 3, 39, 119, 36, 53, 5, 13, 61, 70, 30, 57, 74, 61, 125, 39, 73, 9, 67, 79, 85, - 95, 74, 67, 61, 5, 30, 76, 39, 86, 32, 71, 108, 6, 49, 117, 60, 63, 57, 54, 107, 126, 104, 57, - 59, 120, 68, 6, 108, 81, 113, 126, 64, 36, 60, 123, 117, 13, 68, 8, 116, 114, 119, 125, 61, 81, - 98, 34, 53, 62, 11, 31, 117, 44, 54, 115, 30, 73, 69, 54, 92, 70, 49, 59, 51, 104, 103, 62, 96, - 121, 98, 26, 45, 77, 24, 124, 28, 70, 100, 2, 98, 47, 25, 100, 37, 42, 115, 105, 42, 127, 65, - 24, 102, 122, 33, 79, 87, 22, 47, 35, 50, 59, 54, 68, 16, 36, 91, 127, 39, 16, 113, 68, 20, 76, - 99, 93, 121, 18, 23, 6, 32, 108, 8, 114, 65, 81, 106, 39, 91, 54, 8, 92, 6, 96, 12, 100, 33, 5, - 105, 50, 89, 70, 33, 40, 85, 39, 93, 119, 26, 97, 90, 18, 74, 11, 105, 114, 84, 125, 124, 113, - 86, 124, 90, 90, 87, 64, 83, 121, 39, 108, 66, 23, 55, 43, 31, 110, 96, 42, 4, 64, 41, 110, 97, - 24, 95, 121, 125, 118, 85, 97, 110, 115, 75, 74, 60, 115, 47, 80, 55, 67, 92, 127, 120, 8, 42, - 5, 50, 55, 35, 117, 60, 106, 127, 77, 58, 81, 76, 66, 17, 108, 55, 17, 50, 31, 64, 102, 88, 5, - 32, 12, 37, 120, 48, 46, 43, 99, 12, 16, 114, 50, 49, 12, 3, 63, 64, 27, 54, 53, 31, 73, 2, 15, - 39, 102, 12, 60, 100, 27, 28, 24, 46, 101, 10, 104, 51, 127, 101, 60, 55, 114, 25, 3, 29, 20, - 53, 108, 7, 71, 4, 102, 14, 44, 72, 10, 56, 92, 86, 96, 56, 80, 20, 117, 65, 53, 58, 66, 5, - 103, 88, 17, 10, 34, 63, 83, 84, 43, 70, 41, 8, 111, 117, 31, 80, 29, 12, 115, 75, 84, 91, 91, - 10, 91, 26, 40, 30, 36, 44, 12, 18, 83, 29, 19, 15, 123, 98, 118, 26, 19, 36, 35, 122, 29, 41, - 23, 40, 74, 25, 70, 78, 24, 75, 109, 31, 0, 89, 45, 128, 35, 120, 79, 108, 89, 84, 84, 81, 108, - 47, 2, 112, 2, 42, 126, 12, 15, 15, 109, 109, 97, 76, 126, 5, 23, 66, 65, 1, 39, 102, 121, 127, - 24, 21, 68, 42, 49, 69, 81, 111, 6, 11, 28, 5, 89, 31, 74, 33, 118, 15, 55, 105, 107, 30, 103, - 54, 25, 29, 60, 91, 72, 94, 15, 31, 98, 47, 16, 27, 100, 109, 99, 82, 53, 25, 122, 119, 96, 65, - 4, 24, 50, 79, 40, 65, 6, 91, 125, 7, 80, 103, 88, 22, 107, 38, 39, 100, 102, 96, 1, 66, 44, - 33, 101, 88, 61, 10, 35, 39, 47, 93, 63, 19, 59, 87, 128, 16, 46, 51, 34, 34, 71, 117, 113, 66, - 89, 126, 127, 35, 125, 11, 81, 120, 100, 41, 51, 85, 30, 82, 68, 86, 114, 77, 56, 125, 10, 2, - 95, 75, 31, 33, 84, 83, 22, 35, 99, 12, 18, 40, 4, 88, 104, 46, 100, 99, 113, 45, 36, 51, 88, - 53, 57, 15, 82, 60, 101, 10, 16, 83, 23, 78, 47, 34, 27, 56, 85, 14, 14, 53, 20, 71, 101, 82, - 14, 35, 3, 51, 91, 16, 46, 117, 108, 30, 120, 124, 22, 89, 57, 119, 50, 91, 52, 77, 7, 10, 79, - 5, 21, 81, 43, 58, 61, 59, 39, 60, 122, 23, 68, 21, 19, 81, 3, 31, 64, 54, 126, 56, 23, 64, 28, - 32, 2, 119, 2, 55, 125, 57, 7, 51, 116, 93, 34, 15, 96, 120, 6, 73, 100, 98, 53, 116, 22, 64, - 63, 112, 19, 60, 77, 95, 32, 3, 2, 117, 41, 80, 96, 122, 15, 45, 118, 102, 26, 89, 74, 2, 17, - 63, 21, 52, 23, 82, 97, 22, 68, 39, 119, 117, 128, 49, 71, 55, 38, 55, 87, 3, 76, 80, 13, 57, - 47, 59, 91, 46, 124, 115, 7, 74, 95, 26, 128, 86, 16, 20, 107, 117, 10, 72, 35, 30, 128, 75, - 113, 45, 116, 125, 1, 46, 98, 14, 34, 29, 100, 17, 122, 65, 35, 69, 72, 12, 6, 5, 65, 29, 112, - 47, 21, 103, 63, 118, 75, 21, 99, 6, 36, 46, 86, 59, 9, 117, 23, 82, 75, 13, 4, 9, 104, 43, 73, - 17, 111, 36, 60, 38, 120, 99, 114, 117, 110, 27, 100, 104, 63, 87, 53, 54, 71, 38, 58, 86, 124, - 3, 103, 92, 79, 127, 97, 17, 103, 13, 25, 65, 12, 28, 89, 62, 48, 115, 30, 19, 80, 14, 7, 21, - 124, 91, 104, 110, 97, 97, 0, 104, 124, 93, 24, 70, 13, 99, 91, 73, 55, 84, 25, 22, 111, 115, - 58, 45, 97, 8, 39, 125, 9, 22, 91, 98, 19, 14, 54, 26, 33, 46, 61, 98, 122, 69, 72, 97, 71, 73, - 106, 32, 105, 27, 0, 56, 66, 51, 4, 94, 72, 117, 69, -]; diff --git a/tests/target/configs-array_width-above.rs b/tests/target/configs-array_width-above.rs deleted file mode 100644 index 1265ebe0d8b..00000000000 --- a/tests/target/configs-array_width-above.rs +++ /dev/null @@ -1,14 +0,0 @@ -// rustfmt-array_width: 10 -// Array width - -fn main() { - let lorem = vec![ - "ipsum", - "dolor", - "sit", - "amet", - "consectetur", - "adipiscing", - "elit", - ]; -} diff --git a/tests/target/configs-array_width-below.rs b/tests/target/configs-array_width-below.rs deleted file mode 100644 index d76d539773a..00000000000 --- a/tests/target/configs-array_width-below.rs +++ /dev/null @@ -1,6 +0,0 @@ -// rustfmt-array_width: 100 -// Array width - -fn main() { - let lorem = vec!["ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing", "elit"]; -} diff --git a/tests/target/configs-chain_width-above.rs b/tests/target/configs-chain_width-above.rs deleted file mode 100644 index 1b5e12c331a..00000000000 --- a/tests/target/configs-chain_width-above.rs +++ /dev/null @@ -1,12 +0,0 @@ -// rustfmt-chain_width: 10 -// Chain one line max - -fn main() { - let lorem = ipsum - .dolor() - .sit() - .amet() - .consectetur() - .adipiscing() - .elit(); -} diff --git a/tests/target/configs-chain_width-below.rs b/tests/target/configs-chain_width-below.rs deleted file mode 100644 index d877deb74eb..00000000000 --- a/tests/target/configs-chain_width-below.rs +++ /dev/null @@ -1,6 +0,0 @@ -// rustfmt-chain_width: 100 -// Chain one line max - -fn main() { - let lorem = ipsum.dolor().sit().amet().consectetur().adipiscing().elit(); -} diff --git a/tests/target/configs-fn_call_width-above.rs b/tests/target/configs-fn_call_width-above.rs deleted file mode 100644 index 3f84928ed59..00000000000 --- a/tests/target/configs-fn_call_width-above.rs +++ /dev/null @@ -1,15 +0,0 @@ -// rustfmt-fn_call_width: 10 -// Function call width - -fn main() { - lorem( - "lorem", - "ipsum", - "dolor", - "sit", - "amet", - "consectetur", - "adipiscing", - "elit", - ); -} diff --git a/tests/target/configs-fn_call_width-below.rs b/tests/target/configs-fn_call_width-below.rs deleted file mode 100644 index b79918f5b98..00000000000 --- a/tests/target/configs-fn_call_width-below.rs +++ /dev/null @@ -1,6 +0,0 @@ -// rustfmt-fn_call_width: 100 -// Function call width - -fn main() { - lorem("lorem", "ipsum", "dolor"); -} diff --git a/tests/target/configs-fn_call_width-zero.rs b/tests/target/configs-fn_call_width-zero.rs deleted file mode 100644 index 1455ecd967c..00000000000 --- a/tests/target/configs-fn_call_width-zero.rs +++ /dev/null @@ -1,9 +0,0 @@ -// rustfmt-fn_call_width: 0 -// rustfmt-indent_style: block - -// #1508 -fn a() { - let x = f( - y, - ); -} diff --git a/tests/target/configs-single_line_if_else_max_width-above.rs b/tests/target/configs-single_line_if_else_max_width-above.rs deleted file mode 100644 index d883dbbb469..00000000000 --- a/tests/target/configs-single_line_if_else_max_width-above.rs +++ /dev/null @@ -1,10 +0,0 @@ -// rustfmt-single_line_if_else_max_width: 10 -// Single line if-else max width - -fn main() { - let lorem = if ipsum { - dolor - } else { - sit - }; -} diff --git a/tests/target/configs-single_line_if_else_max_width-below.rs b/tests/target/configs-single_line_if_else_max_width-below.rs deleted file mode 100644 index efafa6c4498..00000000000 --- a/tests/target/configs-single_line_if_else_max_width-below.rs +++ /dev/null @@ -1,6 +0,0 @@ -// rustfmt-single_line_if_else_max_width: 100 -// Single line if-else max width - -fn main() { - let lorem = if ipsum { dolor } else { sit }; -} diff --git a/tests/target/configs-struct_lit_single_line-true.rs b/tests/target/configs-struct_lit_single_line-true.rs deleted file mode 100644 index 363bf5b114e..00000000000 --- a/tests/target/configs-struct_lit_single_line-true.rs +++ /dev/null @@ -1,7 +0,0 @@ -// rustfmt-struct_lit_single_line: true -// rustfmt-struct_lit_width: 100 -// Struct literal multiline-style - -fn main() { - let lorem = Lorem { ipsum: dolor, sit: amet }; -} diff --git a/tests/target/configs-struct_lit_width-above.rs b/tests/target/configs-struct_lit_width-above.rs deleted file mode 100644 index 75a1a64095d..00000000000 --- a/tests/target/configs-struct_lit_width-above.rs +++ /dev/null @@ -1,9 +0,0 @@ -// rustfmt-struct_lit_width: 10 -// Struct literal-style - -fn main() { - let lorem = Lorem { - ipsum: dolor, - sit: amet, - }; -} diff --git a/tests/target/configs-struct_lit_width-below.rs b/tests/target/configs-struct_lit_width-below.rs deleted file mode 100644 index 7ffe4a32eaf..00000000000 --- a/tests/target/configs-struct_lit_width-below.rs +++ /dev/null @@ -1,6 +0,0 @@ -// rustfmt-struct_lit_width: 100 -// Struct literal-style - -fn main() { - let lorem = Lorem { ipsum: dolor, sit: amet }; -} diff --git a/tests/target/configs-struct_variant_width-0.rs b/tests/target/configs-struct_variant_width-0.rs deleted file mode 100644 index 54c93d48031..00000000000 --- a/tests/target/configs-struct_variant_width-0.rs +++ /dev/null @@ -1,29 +0,0 @@ -// rustfmt-struct_variant_width: 0 - -// Force vertical layout when struct_variant_width is set to 0. - -enum State { - TryRecv { - pos: usize, - lap: u8, - closed_count: usize, - }, - Subscribe { - pos: usize, - }, - IsReady { - pos: usize, - ready: bool, - }, - Unsubscribe { - pos: usize, - lap: u8, - id_woken: usize, - }, - FinalTryRecv { - pos: usize, - id_woken: usize, - }, - TimedOut, - Disconnected, -} diff --git a/tests/target/configs-struct_variant_width-above.rs b/tests/target/configs-struct_variant_width-above.rs deleted file mode 100644 index 1fefbda81d5..00000000000 --- a/tests/target/configs-struct_variant_width-above.rs +++ /dev/null @@ -1,11 +0,0 @@ -// rustfmt-struct_variant_width: 10 -// Struct variant width - -enum Lorem { - Ipsum, - Dolor(bool), - Sit { - amet: Consectetur, - adipiscing: Elit, - }, -} diff --git a/tests/target/configs-struct_variant_width-below.rs b/tests/target/configs-struct_variant_width-below.rs deleted file mode 100644 index a16a57e19b8..00000000000 --- a/tests/target/configs-struct_variant_width-below.rs +++ /dev/null @@ -1,8 +0,0 @@ -// rustfmt-struct_variant_width: 100 -// Struct variant width - -enum Lorem { - Ipsum, - Dolor(bool), - Sit { amet: Consectetur, adipiscing: Elit }, -} diff --git a/tests/target/else-if-brace-style-always-next-line.rs b/tests/target/else-if-brace-style-always-next-line.rs index 4a2ef877b85..c180ff697fc 100644 --- a/tests/target/else-if-brace-style-always-next-line.rs +++ b/tests/target/else-if-brace-style-always-next-line.rs @@ -1,4 +1,3 @@ -// rustfmt-single_line_if_else_max_width: 0 // rustfmt-control_brace_style: AlwaysNextLine fn main() { @@ -16,14 +15,7 @@ fn main() { } - let a = if 0 > 1 - { - unreachable!() - } - else - { - 0x0 - }; + let a = if 0 > 1 { unreachable!() } else { 0x0 }; if true diff --git a/tests/target/else-if-brace-style-always-same-line.rs b/tests/target/else-if-brace-style-always-same-line.rs index 9baaa3f9b36..4c6153d5f1f 100644 --- a/tests/target/else-if-brace-style-always-same-line.rs +++ b/tests/target/else-if-brace-style-always-same-line.rs @@ -1,4 +1,3 @@ -// rustfmt-single_line_if_else_max_width: 0 // rustfmt-control_brace_style: AlwaysSameLine fn main() { @@ -15,11 +14,7 @@ fn main() { } - let a = if 0 > 1 { - unreachable!() - } else { - 0x0 - }; + let a = if 0 > 1 { unreachable!() } else { 0x0 }; if true { diff --git a/tests/target/else-if-brace-style-closing-next-line.rs b/tests/target/else-if-brace-style-closing-next-line.rs index f1af1943431..04ee82bb828 100644 --- a/tests/target/else-if-brace-style-closing-next-line.rs +++ b/tests/target/else-if-brace-style-closing-next-line.rs @@ -1,4 +1,3 @@ -// rustfmt-single_line_if_else_max_width: 0 // rustfmt-control_brace_style: ClosingNextLine fn main() { @@ -15,12 +14,7 @@ fn main() { } - let a = if 0 > 1 { - unreachable!() - } - else { - 0x0 - }; + let a = if 0 > 1 { unreachable!() } else { 0x0 }; if true { diff --git a/tests/target/hard-tabs.rs b/tests/target/hard-tabs.rs index 07a96214285..72d366b1fa1 100644 --- a/tests/target/hard-tabs.rs +++ b/tests/target/hard-tabs.rs @@ -1,5 +1,4 @@ // rustfmt-normalize_comments: true -// rustfmt-single_line_if_else_max_width: 0 // rustfmt-wrap_comments: true // rustfmt-hard_tabs: true // rustfmt-error_on_line_overflow: false @@ -73,13 +72,7 @@ fn main() { arg(a, b, c, d, e) } - loong_func().quux(move || { - if true { - 1 - } else { - 2 - } - }); + loong_func().quux(move || if true { 1 } else { 2 }); fffffffffffffffffffffffffffffffffff(a, { SCRIPT_TASK_ROOT.with(|root| { diff --git a/tests/target/issue-1802.rs b/tests/target/issue-1802.rs index 236a49f2ff3..a4679463ba2 100644 --- a/tests/target/issue-1802.rs +++ b/tests/target/issue-1802.rs @@ -1,11 +1,10 @@ // rustfmt-tab_spaces: 2 -// rustfmt-max_width: 10 -// rustfmt-struct_variant_width: 10 +// rustfmt-max_width: 30 // rustfmt-error_on_line_overflow: false enum F { X { - a: d, - b: e, + a: dddddddddddddd, + b: eeeeeeeeeeeeeee, }, } diff --git a/tests/target/single-line-if-else.rs b/tests/target/single-line-if-else.rs index ac55d062134..98fd793cba2 100644 --- a/tests/target/single-line-if-else.rs +++ b/tests/target/single-line-if-else.rs @@ -1,5 +1,3 @@ -// rustfmt-single_line_if_else_max_width: 100 - // Format if-else expressions on a single line, when possible. fn main() { @@ -28,7 +26,11 @@ fn main() { 10 }; - let d = if let Some(val) = turbo { "cool" } else { "beans" }; + let d = if let Some(val) = turbo { + "cool" + } else { + "beans" + }; if cond() { statement(); @@ -46,7 +48,11 @@ fn main() { bbbbbbbbbb }; - let x = if veeeeeeeeery_loooooong_condition() { aaaaaaaaaaaaaaaaaaaaaaaaa } else { bbbbbbbbbb }; + let x = if veeeeeeeeery_loooooong_condition() { + aaaaaaaaaaaaaaaaaaaaaaaaa + } else { + bbbbbbbbbb + }; funk(if test() { 1 } else { 2 }, arg2); }