Use Option.some_if when checking for workspace file

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
This commit is contained in:
Rudi Grinberg 2018-06-30 17:16:39 +07:00
parent 5cbf391a04
commit 2b307bfe99
2 changed files with 2 additions and 5 deletions

View File

@ -62,10 +62,7 @@ let setup ?(log=Log.no_log)
| _ ->
match
let p = Path.of_string Workspace.filename in
if Path.exists p then
Some p
else
None
Option.some_if (Path.exists p) p
with
| Some p -> Workspace.load ?x ?profile p
| None -> Workspace.default ?x ?profile ()

View File

@ -30,7 +30,7 @@ specifying the workspace file is possible:
Raised by primitive operation at file "pervasives.ml", line 389, characters 28-54
Called from file "src/stdune/io.ml", line 15, characters 15-35
Called from file "src/main.ml", line 61, characters 8-36
Called from file "src/main.ml", line 270, characters 12-56
Called from file "src/main.ml", line 267, characters 12-56
Called from file "bin/main.ml", line 756, characters 7-29
Called from file "vendor/cmdliner/src/cmdliner_term.ml", line 27, characters 19-24
Called from file "vendor/cmdliner/src/cmdliner.ml", line 106, characters 32-39