Skip to content

Commit 384e9c2

Browse files
Mershoknocte
authored andcommitted
UnneededRecKeyword: apply fix
Additionally, the "symbol" argument does not need parentheses and the name was confusing, so I renamed it.
1 parent 97c2b9b commit 384e9c2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/FSharpLint.Core/Rules/Conventions/UnneededRecKeyword.fs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,19 @@ open FSharpLint.Framework.Suggestion
99

1010
let runner (args: AstNodeRuleParams) =
1111
match args.AstNode, args.CheckInfo with
12-
| AstNode.ModuleDeclaration (SynModuleDecl.Let (isRecursive, bindings, _)), Some checkInfo when isRecursive ->
12+
| AstNode.ModuleDeclaration (SynModuleDecl.Let (isRecursive, bindings, letRange)), Some checkInfo when isRecursive ->
1313
match bindings with
1414
| SynBinding (_, _, _, _, _, _, _, SynPat.LongIdent (LongIdentWithDots([ident], _), _, _, _, _, range), _, _, _, _) :: _ ->
1515
let symbolUses = checkInfo.GetAllUsesOfAllSymbolsInFile()
1616
let funcName = ident.idText
1717

1818
let functionCalls =
1919
symbolUses
20-
|> Seq.filter (fun (symbol) -> symbol.Symbol.DisplayName = funcName)
20+
|> Seq.filter (fun usage ->
21+
usage.Symbol.DisplayName = funcName
22+
&& usage.Range.StartLine >= letRange.StartLine
23+
&& usage.Range.EndLine <= letRange.EndLine)
24+
2125

2226
if (functionCalls |> Seq.length) <= 1 then
2327
{ Range = range

0 commit comments

Comments
 (0)