Skip to content

Commit aff18a8

Browse files
authored
refactor: remove a bunch of useless "let open Memo.O in" (ocaml#11086)
Signed-off-by: Rudi Grinberg <[email protected]>
1 parent 153fcd1 commit aff18a8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+43
-140
lines changed

src/dune_rules/artifact_substitution.ml

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
open Import
2+
open Memo.O
23

34
(* Artifact substitutions works as follow: the substitution is encoded as a
45
string of the form:
@@ -94,7 +95,6 @@ module Conf = struct
9495
;;
9596

9697
let sign_hook_of_context (context : Context.t) =
97-
let open Memo.O in
9898
let+ config =
9999
let+ ocaml = Context.ocaml context in
100100
ocaml.ocaml_config
@@ -116,7 +116,6 @@ module Conf = struct
116116
;;
117117

118118
let of_context (context : Context.t) =
119-
let open Memo.O in
120119
let get_vcs = Source_tree.nearest_vcs in
121120
let name = Context.name context in
122121
let get_location = Install.Paths.get_local_location name in
@@ -139,7 +138,6 @@ module Conf = struct
139138
;;
140139

141140
let of_install ~relocatable ~roots ~(context : Context.t) =
142-
let open Memo.O in
143141
let get_vcs = Source_tree.nearest_vcs in
144142
let hardcoded_ocaml_path =
145143
match relocatable with
@@ -194,7 +192,6 @@ let eval t ~(conf : Conf.t) =
194192
let relocatable path =
195193
(* return a relative path to the install directory in case of relocatable
196194
instead of absolute path *)
197-
let open Memo.O in
198195
conf.hardcoded_ocaml_path
199196
>>| function
200197
| Hardcoded _ -> Path.to_absolute_filename path
@@ -205,8 +202,7 @@ let eval t ~(conf : Conf.t) =
205202
Fiber.return (Array.make n s |> Array.to_list |> String.concat ~sep:"")
206203
| Vcs_describe p ->
207204
Memo.run
208-
(let open Memo.O in
209-
conf.get_vcs p
205+
(conf.get_vcs p
210206
>>= function
211207
| None -> Memo.return ""
212208
| Some vcs ->
@@ -215,21 +211,19 @@ let eval t ~(conf : Conf.t) =
215211
| Location (name, lib_name) ->
216212
conf.get_location name lib_name |> relocatable |> Memo.run
217213
| Configpath d ->
218-
let open Memo.O in
219214
(let* dir = conf.get_config_path d in
220215
match dir with
221216
| None -> Memo.return None
222217
| Some dir -> relocatable dir >>| Option.some)
223218
>>| Option.value ~default:""
224219
|> Memo.run
225220
| Hardcoded_ocaml_path ->
226-
(let open Memo.O in
227-
conf.hardcoded_ocaml_path
228-
>>| function
229-
| Relocatable _ -> "relocatable"
230-
| Hardcoded l ->
231-
let l = List.map l ~f:Path.to_absolute_filename in
232-
"hardcoded\000" ^ String.concat ~sep:"\000" l)
221+
conf.hardcoded_ocaml_path
222+
>>| (function
223+
| Relocatable _ -> "relocatable"
224+
| Hardcoded l ->
225+
let l = List.map l ~f:Path.to_absolute_filename in
226+
"hardcoded\000" ^ String.concat ~sep:"\000" l)
233227
|> Memo.run
234228
;;
235229

src/dune_rules/artifacts_db.ml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,12 @@ let available_exes ~dir (exes : Executables.t) =
2828
~forbidden_libraries:exes.forbidden_libraries
2929
~allow_overlaps:exes.buildable.allow_overlapping_dependencies
3030
in
31-
let open Memo.O in
3231
let+ available = Lib.Compile.direct_requires compile_info in
3332
Resolve.is_ok available
3433
;;
3534

3635
let get_installed_binaries ~(context : Context.t) stanzas =
3736
let merge _ x y = Some (Appendable_list.( @ ) x y) in
38-
let open Memo.O in
3937
Memo.List.map stanzas ~f:(fun d ->
4038
let dir = Path.Build.append_source (Context.build_dir context) (Dune_file.dir d) in
4139
let* expander = Expander0.get ~dir in

src/dune_rules/blang_expand.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
open Import
2+
open Memo.O
23

34
let rec eval (t : Blang.t) ~dir ~f =
4-
let open Memo.O in
55
match t with
66
| Const x -> Memo.return x
77
| Expr sw ->

src/dune_rules/buildable_rules.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ let ocaml_flags t ~dir (spec : Ocaml_flags.Spec.t) =
2222
;;
2323

2424
let gen_select_rules sctx ~dir compile_info =
25-
let open Memo.O in
2625
Lib.Compile.resolved_selects compile_info
2726
|> Resolve.Memo.read_memo
2827
>>= Memo.parallel_iter ~f:(fun { Lib.Compile.Resolved_select.dst_fn; src_fn } ->

src/dune_rules/cinaps.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
open Import
2+
open Memo.O
23

34
type t =
45
{ loc : Loc.t
@@ -75,7 +76,6 @@ let () =
7576
;;
7677

7778
let gen_rules sctx t ~dir ~scope =
78-
let open Memo.O in
7979
let loc = t.loc in
8080
(* Files checked by cinaps *)
8181
let* cinapsed_files =

src/dune_rules/compilation_context.ml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
open Import
2+
open Memo.O
23

34
module Includes = struct
45
type t = Command.Args.without_targets Command.Args.t Lib_mode.Cm_kind.Map.t
@@ -145,7 +146,6 @@ let create
145146
?loc
146147
()
147148
=
148-
let open Memo.O in
149149
let project = Scope.project scope in
150150
let context = Super_context.context super_context in
151151
let* ocaml = Context.ocaml context in
@@ -325,7 +325,6 @@ let entry_module_names sctx t =
325325
match Lib_info.entry_modules (Lib.info t) with
326326
| External d -> Resolve.Memo.of_result d
327327
| Local ->
328-
let open Memo.O in
329328
let+ modules = Dir_contents.modules_of_lib sctx t in
330329
let modules = Option.value_exn modules in
331330
Resolve.return (Modules.With_vlib.entry_modules modules |> List.map ~f:Module.name)

src/dune_rules/cond_expand.ml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
open! Stdune
21
open! Import
2+
open Memo.O
33

44
let eval (cond : Dune_lang.Cond.t) ~dir ~f =
5-
let open Memo.O in
65
let expand_sw = String_expander.Memo.expand ~mode:Single ~dir ~f in
76
let* from_case =
87
Memo.List.find_map cond.cases ~f:(fun (blang, sw) ->

src/dune_rules/cram/cram_rules.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ let collect_stanzas =
126126
;;
127127

128128
let rules ~sctx ~dir tests =
129-
let open Memo.O in
130129
let* stanzas = collect_stanzas ~dir
131130
and* with_package_mask =
132131
Dune_load.mask ()

src/dune_rules/ctypes/ctypes_rules.ml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
open Import
2+
open Memo.O
23

34
(* This module expands either a (library ... (ctypes ...)) rule or an
45
(executables ... (ctypes ...)) rule into the generated set of .ml and .c
@@ -295,7 +296,6 @@ let gen_rules ~cctx ~(buildable : Buildable.t) ~loc ~scope ~dir ~sctx =
295296
let type_description_functor = ctypes.type_description.functor_ in
296297
let c_types_includer_module = ctypes.generated_types in
297298
let c_generated_types_module = Ctypes_field.c_generated_types_module ctypes in
298-
let open Memo.O in
299299
let foreign_archives_deps =
300300
let { Lib_config.ext_lib; ext_dll; _ } =
301301
(Compilation_context.ocaml cctx).lib_config
@@ -331,7 +331,6 @@ let gen_rules ~cctx ~(buildable : Buildable.t) ~loc ~scope ~dir ~sctx =
331331
|> Memo.return
332332
| Pkg_config ->
333333
let+ () =
334-
let open Memo.O in
335334
let setup query =
336335
let* res = Pkg_config.gen_rule sctx ~dir ~loc query in
337336
match res with

src/dune_rules/dep_rules.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ let deps_of_vlib_module ({ obj_dir; vimpl; dir; sctx; _ } as md) ~ml_kind source
8383
let impl = Vimpl.impl vimpl in
8484
Dune_project.dune_version impl.project
8585
in
86-
let open Memo.O in
8786
let+ deps = ooi_deps md ~dune_version ~vlib_obj_map ~ml_kind sourced_module in
8887
Action_builder.map deps ~f:(List.map ~f:Modules.Sourced_module.to_module)
8988
| Some lib ->

0 commit comments

Comments
 (0)