]> git.lizzy.rs Git - rust.git/blobdiff - Configurations.md
Add explicit lifetime
[rust.git] / Configurations.md
index a8d8c353c27f01a1a91f0f94da34a4efc83d1e99..972c2e58241ac807594c4eb4b876c40bbc019c9a 100644 (file)
@@ -100,6 +100,66 @@ let lorem = vec!["ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing", "
 #### Lines longer than `array_width`:
 See [`array_layout`](#array_layout).
 
+## `attributes_on_same_line_as_field`
+
+Try to put attributes on the same line as fields
+
+- **Default value**: `true`
+- **Possible values**: `true`, `false`
+
+#### `true`
+
+```rust
+struct Lorem {
+    #[serde(rename = "Ipsum")] ipsum: usize,
+    #[serde(rename = "Dolor")] dolor: usize,
+    #[serde(rename = "Amet")] amet: usize,
+}
+```
+
+#### `false`
+
+```rust
+struct Lorem {
+    #[serde(rename = "Ipsum")]
+    ipsum: usize,
+    #[serde(rename = "Dolor")]
+    dolor: usize,
+    #[serde(rename = "Amet")]
+    amet: usize,
+}
+```
+
+## `attributes_on_same_line_as_variant`
+
+Try to put attributes on the same line as variants
+
+- **Default value**: `true`
+- **Possible values**: `true`, `false`
+
+#### `true`
+
+```rust
+enum Lorem {
+    #[serde(skip_serializing)] Ipsum,
+    #[serde(skip_serializing)] Dolor,
+    #[serde(skip_serializing)] Amet,
+}
+```
+
+#### `false`
+
+```rust
+enum Lorem {
+    #[serde(skip_serializing)]
+    Ipsum,
+    #[serde(skip_serializing)]
+    Dolor,
+    #[serde(skip_serializing)]
+    Amet,
+}
+```
+
 ## `chain_indent`
 
 Indentation of chain
@@ -1163,6 +1223,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
@@ -1172,6 +1265,88 @@ Maximum width of each line
 
 See also [`error_on_line_overflow`](#error_on_line_overflow).
 
+## `merge_derives`
+
+Merge multiple derives into a single one.
+
+- **Default value**: `true`
+- **Possible values**: `true`, `false`
+
+#### `true`:
+
+```rust
+#[derive(Eq, PartialEq, Debug, Copy, Clone)]
+pub enum Foo {}
+```
+
+#### `false`:
+
+```rust
+#[derive(Eq, PartialEq)]
+#[derive(Debug)]
+#[derive(Copy, Clone)]
+pub enum Foo {}
+```
+
+## `multiline_closure_forces_block`
+
+Force multiline closure bodies to be wrapped in a block
+
+- **Default value**: `false`
+- **Possible values**: `false`, `true`
+
+#### `true`:
+
+```rust
+
+result.and_then(|maybe_value| {
+    match maybe_value {
+        None => ...,
+        Some(value) => ...,
+    }
+})
+```
+
+#### `false`:
+
+```rust
+result.and_then(|maybe_value| match maybe_value {
+    None => ...,
+    Some(value) => ...,
+})
+```
+
+## `multiline_match_arm_forces_block`
+
+Force multiline match arm bodies to be wrapped in a block
+
+- **Default value**: `false`
+- **Possible values**: `false`, `true`
+
+#### `false`:
+
+```rust
+match lorem {
+    None => if ipsum {
+        println!("Hello World");
+    },
+    Some(dolor) => ...,
+}
+```
+
+#### `true`:
+
+```rust
+match lorem {
+    None => {
+        if ipsum {
+            println!("Hello World");
+        }
+    }
+    Some(dolor) => ...,
+}
+```
+
 ## `newline_style`
 
 Unix or Windows line endings