Skip to content

Commit 2408768

Browse files
committed
Preview: Upgrade to ocamlformat 0.26.0 (unreleased)
The aim of this commit is to gather feedback. Changelog can be found here: https://github.com/ocaml-ppx/ocamlformat/blob/main/CHANGES.md
1 parent 8da4d16 commit 2408768

30 files changed

+113
-91
lines changed

Diff for: .ocamlformat

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version = 0.24.1
1+
version = 0.26.0
22
profile = conventional
33

44
ocaml-version = 4.08.0

Diff for: src/irmin-chunk/irmin_chunk.ml

+2-2
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@ struct
192192
in
193193
let chunking = Conf.get config Conf.Key.chunking in
194194
(if max_children <= 1 then
195-
let min = Chunk.size_of_index_header + (H.hash_size * 2) in
196-
err_too_small ~min chunk_size);
195+
let min = Chunk.size_of_index_header + (H.hash_size * 2) in
196+
err_too_small ~min chunk_size);
197197
[%log.debug
198198
"config: chunk-size=%d digest-size=%d max-data=%d max-children=%d"
199199
chunk_size H.hash_size max_data max_children];

Diff for: src/irmin-graphql/unix/irmin_graphql_unix.ml

+4-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ module Server = struct
2525
end
2626

2727
module Make_ext
28-
(S : Irmin.Generic_key.S) (Remote : sig
28+
(S : Irmin.Generic_key.S)
29+
(Remote : sig
2930
val remote : remote_fn option
3031
end)
3132
(T : Irmin_graphql.Server.CUSTOM_TYPES
@@ -55,7 +56,8 @@ module Server = struct
5556
(T)
5657

5758
module Make
58-
(S : Irmin.Generic_key.S) (Remote : sig
59+
(S : Irmin.Generic_key.S)
60+
(Remote : sig
5961
val remote : remote_fn option
6062
end) =
6163
Irmin_graphql.Server.Make

Diff for: src/irmin-graphql/unix/irmin_graphql_unix.mli

+4-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ module Server : sig
2525
end
2626

2727
module Make
28-
(S : Irmin.Generic_key.S) (Remote : sig
28+
(S : Irmin.Generic_key.S)
29+
(Remote : sig
2930
val remote : remote_fn option
3031
end) :
3132
Irmin_graphql.Server.S
@@ -34,7 +35,8 @@ module Server : sig
3435
and module IO = Cohttp_lwt_unix.IO
3536

3637
module Make_ext
37-
(S : Irmin.Generic_key.S) (Remote : sig
38+
(S : Irmin.Generic_key.S)
39+
(Remote : sig
3840
val remote : remote_fn option
3941
end)
4042
(T : Irmin_graphql.Server.CUSTOM_TYPES

Diff for: src/irmin-http/irmin_http_server.ml

+7-6
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,14 @@ module Make (HTTP : Cohttp_lwt.S.Server) (S : Irmin.S) = struct
6262
let err = Fmt.str "Parse error %S: %s" str e in
6363
Wm.respond ~body:(`String err) 400 rd
6464

65-
module Content_addressable (S : sig
66-
include Irmin.Content_addressable.S
65+
module Content_addressable
66+
(S : sig
67+
include Irmin.Content_addressable.S
6768

68-
val batch : B.Repo.t -> (read_write t -> 'a Lwt.t) -> 'a Lwt.t
69-
end)
70-
(K : Irmin.Type.S with type t = S.key)
71-
(V : Irmin.Type.S with type t = S.value) =
69+
val batch : B.Repo.t -> (read_write t -> 'a Lwt.t) -> 'a Lwt.t
70+
end)
71+
(K : Irmin.Type.S with type t = S.key)
72+
(V : Irmin.Type.S with type t = S.value) =
7273
struct
7374
let with_key rd f =
7475
match Irmin.Type.of_string K.t (Wm.Rd.lookup_path_info_exn "id" rd) with

Diff for: src/irmin-pack/inode.ml

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ exception Max_depth of int
2121

2222
module Make_internal
2323
(Conf : Conf.S)
24-
(H : Irmin.Hash.S) (Key : sig
24+
(H : Irmin.Hash.S)
25+
(Key : sig
2526
include Irmin.Key.S with type hash = H.t
2627

2728
val unfindable_of_hash : hash -> t

Diff for: src/irmin-pack/inode_intf.ml

+2-1
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,8 @@ module type Sigs = sig
256256

257257
module Make_internal
258258
(Conf : Conf.S)
259-
(H : Irmin.Hash.S) (Key : sig
259+
(H : Irmin.Hash.S)
260+
(Key : sig
260261
include Irmin.Key.S with type hash = H.t
261262

262263
val unfindable_of_hash : hash -> t

Diff for: src/irmin-pack/unix/gc.mli

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
open! Import
1818

1919
(** [Make] returns a module that can manage GC processes. *)
20-
module Make (Args : Gc_args.S) : sig
20+
module Make
21+
(Args : Gc_args.S) : sig
2122
module Args : Gc_args.S
2223

2324
type t

Diff for: src/irmin-pack/unix/gc_worker.mli

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
open! Import
2020
module Payload = Control_file.Payload.Upper.Latest
2121

22-
module Make (Args : Gc_args.S) : sig
22+
module Make
23+
(Args : Gc_args.S) : sig
2324
module Args : Gc_args.S
2425

2526
val run_and_output_result :

Diff for: src/irmin-pack/unix/lower.ml

+13-13
Original file line numberDiff line numberDiff line change
@@ -385,19 +385,19 @@ module Make (Io : Io.S) (Errs : Io_errors.S with module Io = Io) = struct
385385
let archive_seq_exn ~upper_root ~generation ~to_archive t =
386386
Errs.raise_if_error
387387
(let open Result_syntax in
388-
let* () = if t.readonly then Error `Ro_not_allowed else Ok () in
389-
let* v =
390-
match appendable_volume t with
391-
| None -> Error `Lower_has_no_volume
392-
| Some v -> Ok v
393-
in
394-
let* () =
395-
match t.open_volume with
396-
| None -> Ok ()
397-
| Some v0 -> if Volume.eq v0 v then close_open_volume t else Ok ()
398-
in
399-
let is_first = volume_num t = 1 in
400-
Volume.archive_seq ~upper_root ~generation ~to_archive ~is_first v)
388+
let* () = if t.readonly then Error `Ro_not_allowed else Ok () in
389+
let* v =
390+
match appendable_volume t with
391+
| None -> Error `Lower_has_no_volume
392+
| Some v -> Ok v
393+
in
394+
let* () =
395+
match t.open_volume with
396+
| None -> Ok ()
397+
| Some v0 -> if Volume.eq v0 v then close_open_volume t else Ok ()
398+
in
399+
let is_first = volume_num t = 1 in
400+
Volume.archive_seq ~upper_root ~generation ~to_archive ~is_first v)
401401

402402
let read_exn ~off ~len ?volume t b =
403403
let _, volume = read_range_exn ~off ~min_len:len ~max_len:len ?volume t b in

Diff for: src/irmin-pack/unix/pack_store.ml

+3-3
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,9 @@ struct
239239
become valid on [reload]; otherwise we know that this key wasn't
240240
constructed for this store. *)
241241
(if not (Control.readonly (Fm.control t.fm)) then
242-
let io_offset = Dispatcher.end_offset t.dispatcher in
243-
invalid_read "invalid key %a checked for membership (IO offset = %a)"
244-
pp_key k Int63.pp io_offset);
242+
let io_offset = Dispatcher.end_offset t.dispatcher in
243+
invalid_read "invalid key %a checked for membership (IO offset = %a)"
244+
pp_key k Int63.pp io_offset);
245245
false
246246
| Errors.Pack_error (`Invalid_sparse_read _) -> false
247247
| Errors.Pack_error (`Invalid_prefix_read _) -> false

Diff for: src/irmin-test/irmin_bench.mli

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1616
*)
1717

18-
module Make (S : Irmin.Generic_key.KV with type Schema.Contents.t = string) : sig
18+
module Make
19+
(S : Irmin.Generic_key.KV with type Schema.Contents.t = string) : sig
1920
val run :
2021
config:(root:string -> Irmin.config) -> size:(root:string -> int) -> unit
2122
end

Diff for: src/irmin/commit_intf.ml

+3-1
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,9 @@ module type Sigs = sig
259259
module Info : Info.S with type t = Info.Default.t
260260
(** Serialisation format for V1 info. *)
261261

262-
module Make (Hash : Hash.S) (C : Generic_key.S with module Info := Info) : sig
262+
module Make
263+
(Hash : Hash.S)
264+
(C : Generic_key.S with module Info := Info) : sig
263265
include
264266
Generic_key.S
265267
with module Info = Info

Diff for: src/irmin/dot.ml

+2-2
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ module Make (S : Store.Generic_key.S) = struct
9090
let label_of_node k _ =
9191
let s =
9292
(if html then
93-
sprintf "<div class='node'><div class='sha1'>%s</div></div>"
94-
else fun x -> x)
93+
sprintf "<div class='node'><div class='sha1'>%s</div></div>"
94+
else fun x -> x)
9595
(string_of_hash Node.Hash.t k)
9696
in
9797
`Label s

Diff for: src/irmin/irmin.mli

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ end
5454
module Type = Repr
5555
(** Dynamic types for Irmin values, supplied by
5656
{{:https://github.com/mirage/repr} [Repr]}. These values can be derived from
57-
type definitions via [\[@@deriving irmin\]] (see the
57+
type definitions via [[@@deriving irmin]] (see the
5858
{{:https://github.com/mirage/irmin/blob/main/README_PPX.md} documentation
59-
for [ppx_irmin]})*)
59+
for [ppx_irmin]})*)
6060

6161
module Hash = Hash
6262
(** Hashing functions.

Diff for: src/irmin/node.ml

+8-4
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ module Irmin_hash = Hash
7878
(* A [Make] implementation providing the subset of [S] that can be implemented
7979
over abstract [key] types. *)
8080
module Make_core
81-
(Hash : Hash.S) (Path : sig
81+
(Hash : Hash.S)
82+
(Path : sig
8283
type step [@@deriving irmin]
8384
end)
8485
(Metadata : Metadata.S)
@@ -335,7 +336,8 @@ module Portable = struct
335336
end
336337

337338
module Make_generic_key
338-
(Hash : Hash.S) (Path : sig
339+
(Hash : Hash.S)
340+
(Path : sig
339341
type step [@@deriving irmin]
340342
end)
341343
(Metadata : Metadata.S)
@@ -403,7 +405,8 @@ struct
403405
end
404406

405407
module Make_generic_key_v2
406-
(Hash : Hash.S) (Path : sig
408+
(Hash : Hash.S)
409+
(Path : sig
407410
type step [@@deriving irmin]
408411
end)
409412
(Metadata : Metadata.S)
@@ -422,7 +425,8 @@ struct
422425
end
423426

424427
module Make
425-
(Hash : Hash.S) (Path : sig
428+
(Hash : Hash.S)
429+
(Path : sig
426430
type step [@@deriving irmin]
427431
end)
428432
(Metadata : Metadata.S) =

Diff for: src/irmin/node_intf.ml

+2-1
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,8 @@ module type Sigs = sig
351351
and metadata implementations. The contents and node values are addressed
352352
directly by their hash. *)
353353
module Make
354-
(Hash : Hash.S) (Path : sig
354+
(Hash : Hash.S)
355+
(Path : sig
355356
type step [@@deriving irmin]
356357
end)
357358
(Metadata : Metadata.S) :

Diff for: src/irmin/proof.ml

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ include Proof_intf
1919

2020
module Make
2121
(C : Type.S)
22-
(H : Type.S) (S : sig
22+
(H : Type.S)
23+
(S : sig
2324
type step [@@deriving irmin]
2425
end)
2526
(M : Type.S) =

Diff for: src/irmin/proof_intf.ml

+5-4
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ module type S = sig
7171
concrete proof or a hash of that proof.
7272
7373
If an inode proof contains singleton children [i_0, ..., i_n] such as:
74-
[{length=l; proofs = \[ (i_0, {proofs = ... { proofs = \[ (i_n, p) \] }})\]}],
74+
[{length=l; proofs = [ (i_0, {proofs = ... { proofs = [ (i_n, p) ] }})]}],
7575
then it is compressed into the inode extender
76-
[{length=l; segment = \[i_0;..;i_n\]; proof=p}] sharing the same length
77-
[l] and final proof [p]. *)
76+
[{length=l; segment = [i_0;..;i_n]; proof=p}] sharing the same length [l]
77+
and final proof [p]. *)
7878

7979
(** The type for compressed and partial Merkle tree proofs.
8080
@@ -329,7 +329,8 @@ module type Proof = sig
329329

330330
module Make
331331
(C : Type.S)
332-
(H : Hash.S) (P : sig
332+
(H : Hash.S)
333+
(P : sig
333334
type step [@@deriving irmin]
334335
end)
335336
(M : Type.S) : sig

Diff for: src/irmin/store_intf.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1130,7 +1130,7 @@ module type S_generic_key = sig
11301130
(** {Deprecated} *)
11311131

11321132
val master : repo -> t Lwt.t
1133-
[@@ocaml.deprecated "Use `main` instead."]
1133+
[@@ocaml.deprecated "Use `main` instead."]
11341134
(** @deprecated Use {!main} instead *)
11351135
end
11361136

Diff for: src/irmin/tree.ml

+2-2
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,7 @@ module Make (P : Backend.S) = struct
921921
let rec aux acc = function
922922
| [] ->
923923
(if cache then
924-
match acc with Node n -> t.info.value <- Some n | Pnode _ -> ());
924+
match acc with Node n -> t.info.value <- Some n | Pnode _ -> ());
925925
k acc
926926
| (k, Add e) :: rest ->
927927
hash_preimage_value_of_elt ~cache e (fun e ->
@@ -2420,7 +2420,7 @@ module Make (P : Backend.S) = struct
24202420
| [] ->
24212421
k
24222422
(if StepMap.is_empty map then Empty
2423-
else Non_empty (Node.of_map ~env:(Env.empty ()) map))
2423+
else Non_empty (Node.of_map ~env:(Env.empty ()) map))
24242424
| (s, n) :: t ->
24252425
(concrete [@tailcall]) n (fun v ->
24262426
(tree [@tailcall])

Diff for: src/irmin/tree_intf.ml

+3-2
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,9 @@ module type S = sig
307307
[post path steps].
308308
- If [n] is any kind, call [tree path t'] where [t'] is the tree of [n].
309309
310-
See {{:https://github.com/mirage/irmin/blob/main/examples/fold.ml}
311-
examples/fold.ml} for a demo of the different {!folder}s.
310+
See
311+
{{:https://github.com/mirage/irmin/blob/main/examples/fold.ml}
312+
examples/fold.ml} for a demo of the different {!folder}s.
312313
313314
See {!force} for details about the [force] parameters. By default it is
314315
[`True].

Diff for: src/libirmin/commit.ml

+10-10
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ module Make (I : Cstubs_inverted.INTERNAL) = struct
4949
(repo @-> hash @-> returning commit)
5050
(fun (type repo) repo hash ->
5151
with_repo' repo commit
52-
(fun (module Store : Irmin.Generic_key.S with type repo = repo) repo
53-
->
52+
(fun
53+
(module Store : Irmin.Generic_key.S with type repo = repo) repo ->
5454
let hash = Root.get_hash (module Store) hash in
5555
let c = run (Store.Commit.of_hash repo hash) in
5656
match c with
@@ -62,8 +62,8 @@ module Make (I : Cstubs_inverted.INTERNAL) = struct
6262
(repo @-> commit_key @-> returning commit)
6363
(fun (type repo) repo hash ->
6464
with_repo' repo commit
65-
(fun (module Store : Irmin.Generic_key.S with type repo = repo) repo
66-
->
65+
(fun
66+
(module Store : Irmin.Generic_key.S with type repo = repo) repo ->
6767
let hash = Root.get_commit_key (module Store) hash in
6868
let c = run (Store.Commit.of_key repo hash) in
6969
match c with
@@ -75,8 +75,8 @@ module Make (I : Cstubs_inverted.INTERNAL) = struct
7575
(repo @-> ptr commit @-> uint64_t @-> tree @-> info @-> returning commit)
7676
(fun (type repo) repo parents n tree info ->
7777
with_repo' repo commit
78-
(fun (module Store : Irmin.Generic_key.S with type repo = repo) repo
79-
->
78+
(fun
79+
(module Store : Irmin.Generic_key.S with type repo = repo) repo ->
8080
let n = UInt64.to_int n in
8181
let parents =
8282
if is_null parents || n = 0 then []
@@ -97,8 +97,8 @@ module Make (I : Cstubs_inverted.INTERNAL) = struct
9797
(repo @-> commit @-> returning commit_array)
9898
(fun (type repo) repo commit ->
9999
with_repo' repo commit_array
100-
(fun (module Store : Irmin.Generic_key.S with type repo = repo) repo
101-
->
100+
(fun
101+
(module Store : Irmin.Generic_key.S with type repo = repo) repo ->
102102
let commit = Root.get_commit (module Store) commit in
103103
let parents = Store.Commit.parents commit in
104104
let parents =
@@ -117,8 +117,8 @@ module Make (I : Cstubs_inverted.INTERNAL) = struct
117117
(repo @-> commit @-> commit @-> returning bool)
118118
(fun (type repo) repo a b ->
119119
with_repo repo false
120-
(fun (module Store : Irmin.Generic_key.S with type repo = repo) repo
121-
->
120+
(fun
121+
(module Store : Irmin.Generic_key.S with type repo = repo) repo ->
122122
let a = Root.get_commit (module Store) a in
123123
let b = Root.get_commit (module Store) b in
124124
Irmin.Type.(unstage (equal (Store.commit_t repo))) a b))

0 commit comments

Comments
 (0)