Skip to content

Commit 59fba40

Browse files
committed
Core: refactor 'removeParens' function for DRY
1 parent b1c798f commit 59fba40

File tree

3 files changed

+2
-5
lines changed

3 files changed

+2
-5
lines changed

src/FSharpLint.Core/Framework/Ast.fs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@ module Ast =
4545
attrs
4646
|> List.collect (fun attrList -> attrList.Attributes)
4747

48-
/// Extracts an expression from parentheses e.g. ((x + 4)) -> x + 4
49-
let rec removeParens = function
50-
| SynExpr.Paren(x, _, _, _) -> removeParens x
51-
| x -> x
52-
5348
/// Inlines pipe operators to give a flat function application expression
5449
/// e.g. `x |> List.map id` to `List.map id x`.
5550
let (|FuncApp|_|) functionApplication =

src/FSharpLint.Core/Rules/Conventions/FunctionReimplementation/CanBeReplacedWithComposition.fs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ open FSharpLint.Framework.Suggestion
66
open FSharp.Compiler.Syntax
77
open FSharpLint.Framework.Ast
88
open FSharpLint.Framework.Rules
9+
open FSharpLint.Framework.ExpressionUtilities
910

1011
let private validateLambdaCannotBeReplacedWithComposition _ lambda range =
1112
let canBeReplacedWithFunctionComposition expression =

tests/FSharpLint.Core.Tests/Framework/TestAbstractSyntaxArray.fs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ open FSharp.Compiler.Syntax
88
open Microsoft.FSharp.Reflection
99
open NUnit.Framework
1010
open TestUtils
11+
open FSharpLint.Framework.ExpressionUtilities
1112

1213
[<TestFixture>]
1314
type TestAst() =

0 commit comments

Comments
 (0)