Add mach_pattern_separator_break_point config option

This commit is contained in:
Seiichi Uchida 2017-08-18 23:19:11 +09:00
parent f9d279576f
commit a3567cec94
2 changed files with 36 additions and 1 deletions

View File

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

View File

@ -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<Option<PathBuf>, 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,