Skip to content

Commit 2709776

Browse files
committed
ocamlformat 0.17
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
1 parent bb438db commit 2709776

36 files changed

+20505
-21097
lines changed

.github/workflows/build-and-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
if: steps.cache-opam.outputs.cache-hit != 'true'
6767
run: |
6868
opam install . --with-doc --with-test --locked --ignore-constraints-on=ocaml
69-
opam install ocamlformat.0.15.1 --skip-updates
69+
opam install ocamlformat.0.17.0 --skip-updates
7070
7171
- name: Fix broken opam state
7272
if: steps.cache-opam.outputs.cache-hit == 'true'

.ocamlformat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version=0.15.1
1+
version=0.17.0
22
break-separators=before
33
dock-collection-brackets=false
44
break-sequences=true

fiber-test/fiber_test.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ let test ?(expect_never = false) to_dyn f =
4747
in
4848
Fiber.with_error_handler (fun () -> f) ~on_error
4949
in
50-
( try Scheduler.run (Scheduler.create ()) f |> to_dyn |> print_dyn
51-
with Scheduler.Never -> never_raised := true );
50+
(try Scheduler.run (Scheduler.create ()) f |> to_dyn |> print_dyn with
51+
| Scheduler.Never -> never_raised := true);
5252
match (!never_raised, expect_never) with
5353
| false, false ->
5454
(* We don't raise in this case b/c we assume something else is being tested *)

fiber-unix/src/barrier.ml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ let close t =
2828
| Closed -> ()
2929
| Active { mutex; await_mutex = _; r; w; buf = _ } ->
3030
Mutex.lock mutex;
31-
(try Unix.close w with Unix.Unix_error _ -> ());
32-
(try Unix.close r with Unix.Unix_error _ -> ());
31+
(try Unix.close w with
32+
| Unix.Unix_error _ -> ());
33+
(try Unix.close r with
34+
| Unix.Unix_error _ -> ());
3335
t := Closed;
3436
Mutex.unlock mutex
3537

@@ -50,7 +52,7 @@ let rec drain_pipe fd buf read_once =
5052
match select fd 0. with
5153
| Ok `Empty -> Ok ()
5254
| Ok `Ready_to_read -> drain_pipe fd buf read_once
53-
| Error `Closed -> Error (`Closed (`Read read_once)) )
55+
| Error `Closed -> Error (`Closed (`Read read_once)))
5456
| _ -> assert false
5557

5658
let await ?(timeout = -1.) t =
@@ -72,4 +74,4 @@ let signal t =
7274
close t;
7375
Error `Closed
7476
| 1 -> Ok ()
75-
| _ -> assert false )
77+
| _ -> assert false)

fiber-unix/src/fiber_stream.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ module In = struct
2424
| Some x -> (
2525
match f x with
2626
| None -> filter_map t ~f ()
27-
| Some y -> Fiber.return (Some y) )
27+
| Some y -> Fiber.return (Some y))
2828

2929
let map t ~f = filter_map t ~f:(fun x -> Some (f x))
3030

fiber-unix/src/import.ml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,12 @@ module Log = struct
2727
let log ?section k =
2828
if !level section then (
2929
let message = k () in
30-
( match section with
30+
(match section with
3131
| None -> Format.fprintf !out "%s@." message.message
32-
| Some section -> Format.fprintf !out "[%s] %s@." section message.message
33-
);
34-
( match message.payload with
32+
| Some section -> Format.fprintf !out "[%s] %s@." section message.message);
33+
(match message.payload with
3534
| [] -> ()
36-
| fields -> Format.fprintf !out "%a@." Json.pp (`Assoc fields) );
35+
| fields -> Format.fprintf !out "%a@." Json.pp (`Assoc fields));
3736
Format.pp_print_flush !out ()
3837
)
3938
end

fiber-unix/src/removable_queue.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,15 @@ let pop (type a) (t : a t) : a option =
5252

5353
let remove node =
5454
if Option.is_some node.queue then (
55-
( match (node.next, node.prev) with
55+
(match (node.next, node.prev) with
5656
| None, None -> Option.value_exn node.queue := Empty
5757
| _, _ -> (
58-
( match node.next with
58+
(match node.next with
5959
| None -> ()
60-
| Some next -> next.prev <- node.prev );
60+
| Some next -> next.prev <- node.prev);
6161
match node.prev with
6262
| None -> ()
63-
| Some prev -> prev.next <- node.next ) );
63+
| Some prev -> prev.next <- node.next));
6464
node.prev <- None;
6565
node.next <- None;
6666
node.queue <- None

fiber-unix/src/scheduler.ml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ end = struct
4444
| Stopped _ -> (
4545
match Removable_queue.pop t.work with
4646
| None -> t.state <- Finished
47-
| Some job -> do_work job )
47+
| Some job -> do_work job)
4848
| Finished -> ()
4949
| Running _ -> (
5050
match Removable_queue.pop t.work with
@@ -53,7 +53,7 @@ end = struct
5353
while Removable_queue.is_empty t.work && is_running t do
5454
Condition.wait t.work_available t.mutex
5555
done;
56-
loop () )
56+
loop ())
5757
and do_work job =
5858
Mutex.unlock t.mutex;
5959
f job;
@@ -175,9 +175,9 @@ let time_loop t =
175175
else
176176
earliest_next :=
177177
Some
178-
( match !earliest_next with
178+
(match !earliest_next with
179179
| None -> scheduled_at
180-
| Some v -> min scheduled_at v );
180+
| Some v -> min scheduled_at v);
181181
not need_to_run));
182182
let to_run =
183183
List.sort !to_run ~compare:(fun x y ->
@@ -220,7 +220,7 @@ let wake_loop t =
220220
else (
221221
signal_timers_available t;
222222
loop None
223-
) )
223+
))
224224
in
225225
loop None
226226

fiber-unix/test/barrier_tests.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ let () = Printexc.record_backtrace false
44

55
let print_result x =
66
print_endline
7-
( match x with
7+
(match x with
88
| Ok () -> "ok"
99
| Error (`Closed (`Read b)) -> Printf.sprintf "closed with read: %b" b
10-
| Error `Timeout -> "timeout" )
10+
| Error `Timeout -> "timeout")
1111

1212
let print_signal x =
1313
match x with

jsonrpc-fiber/src/import.ml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,8 @@ module Json = struct
104104
let untagged_union (type a) name (xs : (t -> a) list) (json : t) : a =
105105
match
106106
List.find_map xs ~f:(fun conv ->
107-
try Some (conv json)
108-
with Ppx_yojson_conv_lib.Yojson_conv.Of_yojson_error (_, _) ->
109-
None)
107+
try Some (conv json) with
108+
| Ppx_yojson_conv_lib.Yojson_conv.Of_yojson_error (_, _) -> None)
110109
with
111110
| None -> error name json
112111
| Some x -> x
@@ -128,7 +127,7 @@ module Json = struct
128127
match ks with
129128
| [] -> error (sprintf "%s: key %s not found" name k) json
130129
| [ _ ] -> f (`Assoc xs)
131-
| _ :: _ -> error (sprintf "%s: multiple keys %s" name k) json )
130+
| _ :: _ -> error (sprintf "%s: multiple keys %s" name k) json)
132131
| _ -> error (sprintf "%s: not a record (key: %s)" name k) json
133132
end
134133

@@ -223,13 +222,12 @@ module Log = struct
223222
let log ?section k =
224223
if !level section then (
225224
let message = k () in
226-
( match section with
225+
(match section with
227226
| None -> Format.fprintf !out "%s@." message.message
228-
| Some section -> Format.fprintf !out "[%s] %s@." section message.message
229-
);
230-
( match message.payload with
227+
| Some section -> Format.fprintf !out "[%s] %s@." section message.message);
228+
(match message.payload with
231229
| [] -> ()
232-
| fields -> Format.fprintf !out "%a@." Json.pp (`Assoc fields) );
230+
| fields -> Format.fprintf !out "%a@." Json.pp (`Assoc fields));
233231
Format.pp_print_flush !out ()
234232
)
235233
end

0 commit comments

Comments
 (0)