Skip to content

Commit aa9d18a

Browse files
Merge pull request #983 from MisterDA/pre-allocated-promises
Use Lwt's pre-allocated promises
2 parents 70e6622 + e7dc5c0 commit aa9d18a

33 files changed

+290
-290
lines changed

src/core/lwt_list.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ let rec find_s f l =
182182
(find_s [@ocaml.tailcall]) f l
183183

184184
let _optionalize f x =
185-
f x >>= fun b -> if b then Lwt.return (Some x) else Lwt.return None
185+
f x >>= fun b -> if b then Lwt.return (Some x) else Lwt.return_none
186186

187187
let filter_s f l =
188188
filter_map_s (_optionalize f) l

src/unix/lwt_io.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1504,7 +1504,7 @@ let rec delete_recursively directory =
15041504
|> Lwt_stream.iter_s begin fun entry ->
15051505
if entry = Filename.current_dir_name ||
15061506
entry = Filename.parent_dir_name then
1507-
Lwt.return ()
1507+
Lwt.return_unit
15081508
else
15091509
let path = Filename.concat directory entry in
15101510
Lwt_unix.lstat path >>= fun {Lwt_unix.st_kind; _} ->

src/unix/lwt_throttle.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ module Make (H : Hashtbl.HashedType) : (S with type key = H.t) = struct
8383
replacing. *)
8484
prerr_endline "internal error";
8585
Printexc.print_backtrace stderr;
86-
Lwt.return ())
86+
Lwt.return_unit)
8787
in
8888
Some t
8989

0 commit comments

Comments
 (0)