Skip to content

Commit abcc17a

Browse files
committed
Slight refactor
1 parent cdab7de commit abcc17a

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/Fantomas.Core/CodePrinter.fs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1888,13 +1888,15 @@ let genTupleExpr (node: ExprTupleNode) =
18881888
| _ -> expr
18891889

18901890
let shortExpression =
1891+
let lastIndex = Array.length node.Children - 1
1892+
18911893
coli sepNone node.Items (fun i c ->
1892-
match i, c with
1893-
| i, Choice1Of2 e ->
1894+
match c with
1895+
| Choice1Of2 e ->
18941896
match e with
1895-
| IsLambdaOrIfThenElse e when i <> Array.length node.Children - 1 -> sepOpenT +> genExpr e +> sepCloseT
1897+
| IsLambdaOrIfThenElse e when i <> lastIndex -> sepOpenT +> genExpr e +> sepCloseT
18961898
| e -> genExpr (wrapInfixAppRhsInParenIfNeeded e)
1897-
| _, Choice2Of2 comma -> genSingleTextNode comma +> addSpaceIfSpaceAfterComma)
1899+
| Choice2Of2 comma -> genSingleTextNode comma +> addSpaceIfSpaceAfterComma)
18981900

18991901
let longExpression = genTupleMultiline node
19001902

0 commit comments

Comments
 (0)