diff --git a/Configurations.md b/Configurations.md index a8d8c353c27..99740cb4b48 100644 --- a/Configurations.md +++ b/Configurations.md @@ -1163,6 +1163,39 @@ match lorem { See also: [`indent_match_arms`](#indent_match_arms), [`trailing_comma`](#trailing_comma), [`wrap_match_arms`](#wrap_match_arms). +## `match_pattern_separator_break_point` + +Put a match sub-patterns' separator (`|`) in front or back. + +- **Default value**: `"Back"` +- **Possible values**: `"Back"`, `"Front"` + +#### `"Back"` + +```rust +match m { + Variant::Tag | + Variant::Tag2 | + Variant::Tag3 | + Variant::Tag4 | + Variant::Tag5 | + Variant::Tag6 => {} +} +``` + +#### `Front` + +```rust +match m { + Variant::Tag + | Variant::Tag2 + | Variant::Tag3 + | Variant::Tag4 + | Variant::Tag5 + | Variant::Tag6 => {} +} +``` + ## `max_width` Maximum width of each line diff --git a/src/config.rs b/src/config.rs index 11d64dc073f..3c1afe8ddfa 100644 --- a/src/config.rs +++ b/src/config.rs @@ -17,7 +17,7 @@ use std::path::{Path, PathBuf}; use file_lines::FileLines; -use lists::{ListTactic, SeparatorTactic}; +use lists::{ListTactic, SeparatorPlace, SeparatorTactic}; macro_rules! configuration_option_enum{ ($e:ident: $( $x:ident ),+ $(,)*) => { @@ -581,6 +581,8 @@ pub fn get_toml_path(dir: &Path) -> Result, Error> { "Put a trailing comma after a block based match arm (non-block arms are not affected)"; indent_match_arms: bool, true, "Indent match arms instead of keeping them at the same \ indentation level as the match keyword"; + match_pattern_separator_break_point: SeparatorPlace, SeparatorPlace::Back, + "Put a match sub-patterns' separator in front or back."; closure_block_indent_threshold: isize, 7, "How many lines a closure must have before it is \ block indented. -1 means never use block indent."; space_before_type_annotation: bool, false,