Skip to content

Commit

Permalink
refactor: remove duplicate function
Browse files Browse the repository at this point in the history
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>

ps-id: af3ea039-4112-4bcf-b621-047ab460e9e3
  • Loading branch information
rgrinberg committed Aug 27, 2022
1 parent 806f39b commit 87bc1bf
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/dune_cache/local.ml
Original file line number Diff line number Diff line change
Expand Up @@ -198,16 +198,8 @@ module Artifacts = struct
let result = store_metadata ~mode ~rule_digest ~metadata:[] artifacts in
Store_artifacts_result.of_store_result ~artifacts result)

let rec fold_list_result l ~init ~f =
match l with
| [] -> Ok init
| x :: xs -> (
match f init x with
| Ok acc -> fold_list_result xs ~init:acc ~f
| Error e -> Error e)

let create_all_or_nothing ~create ~destroy list =
fold_list_result list ~init:[] ~f:(fun acc x ->
Result.List.fold_left list ~init:[] ~f:(fun acc x ->
match create x with
| Error e ->
List.iter acc ~f:destroy;
Expand Down

0 comments on commit 87bc1bf

Please sign in to comment.