Skip to content

Commit d2aa6e4

Browse files
committed
Tiny refactor
1 parent dd06da7 commit d2aa6e4

File tree

1 file changed

+9
-17
lines changed

1 file changed

+9
-17
lines changed

analysis/src/Packages.ml

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -119,21 +119,13 @@ let getPackage ~uri state =
119119
else
120120
match findRoot ~uri state.packagesByRoot with
121121
| None -> Error "No root directory found"
122-
| Some root -> (
123-
match
124-
match root with
125-
| `Root rootPath ->
126-
Hashtbl.replace state.rootForUri uri rootPath;
127-
Ok
128-
(Hashtbl.find state.packagesByRoot
129-
(Hashtbl.find state.rootForUri uri))
130-
| `Bs rootPath -> (
131-
match newBsPackage rootPath with
132-
| Error e -> Error e
133-
| Ok package ->
134-
Hashtbl.replace state.rootForUri uri package.rootPath;
135-
Hashtbl.replace state.packagesByRoot package.rootPath package;
136-
Ok package)
137-
with
122+
| Some (`Root rootPath) ->
123+
Hashtbl.replace state.rootForUri uri rootPath;
124+
Ok (Hashtbl.find state.packagesByRoot (Hashtbl.find state.rootForUri uri))
125+
| Some (`Bs rootPath) -> (
126+
match newBsPackage rootPath with
138127
| Error e -> Error e
139-
| Ok package -> Ok package)
128+
| Ok package ->
129+
Hashtbl.replace state.rootForUri uri package.rootPath;
130+
Hashtbl.replace state.packagesByRoot package.rootPath package;
131+
Ok package)

0 commit comments

Comments
 (0)