Repository: nix-community/nixpkgs-fmt (rust)

Issue:
sample: if then else indent
## Input
```nix
 if
 foo
 then
 bar
 else
 baz

```

## Output
```nix
if
foo
then
bar
else
baz

```

## Desired output

```nix
if
  foo
then
  bar
else
  baz
```


Pull request:
indent if expression
closes #62

bors r+

Patch:
diff --git a/src/rules.rs b/src/rules.rs
index 8a734b9..c449022 100644
--- a/src/rules.rs
+++ b/src/rules.rs
@@ -142,6 +142,7 @@ pub(crate) fn indentation() -> IndentDsl {
             .indent(VALUES)
 
         .inside(NODE_INHERIT).indent([NODE_IDENT, NODE_INHERIT_FROM, T![;]])
+        .inside(NODE_IF_ELSE).indent(VALUES)
 
         // FIXME: don't force indent if comment is on the first line
         .inside(ENTRY_OWNERS).indent(TOKEN_COMMENT)
@@ -228,6 +229,7 @@ static VALUES: &[SyntaxKind] = &[
     NODE_STRING,
     NODE_VALUE,
     NODE_APPLY,
+    NODE_IF_ELSE,
 ];
 
 static BIN_OPS: &[SyntaxKind] = &[


Test patch:
diff --git a/test_data/if_then_else_indent.bad.nix b/test_data/if_then_else_indent.bad.nix
new file mode 100644
index 0000000..f16826b
--- /dev/null
+++ b/test_data/if_then_else_indent.bad.nix
@@ -0,0 +1,13 @@
+if
+true
+then
+1
+else if false
+then
+2
+else
+if true
+then
+3
+else
+4
diff --git a/test_data/if_then_else_indent.good.nix b/test_data/if_then_else_indent.good.nix
new file mode 100644
index 0000000..ec23e99
--- /dev/null
+++ b/test_data/if_then_else_indent.good.nix
@@ -0,0 +1,13 @@
+if
+  true
+then
+  1
+else if false
+then
+  2
+else
+  if true
+  then
+    3
+  else
+    4