Skip to content

Commit

Permalink
refactor: remove pointless conversion in [Command.t] (#10278)
Browse files Browse the repository at this point in the history
Signed-off-by: Rudi Grinberg <[email protected]>
  • Loading branch information
rgrinberg committed Mar 28, 2024
1 parent 9265e2c commit a5e6f97
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/dune_rules/command.ml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,14 @@ module Args0 = struct
let dyn args = Dyn (Action_builder.map args ~f:(fun x -> As x))
let empty = S []

let rec as_any : without_targets t -> any t = function
let as_any : without_targets t -> any t = function
| A _ as x -> (x :> any t)
| As _ as x -> (x :> any t)
| S l -> S (List.map l ~f:as_any)
| Concat (sep, l) -> Concat (sep, List.map l ~f:as_any)
(* We can't convince the type checker to do a cast, so we force it.
See the discussion in https://github.com/ocaml/dune/pull/10278 to see why
the pattern match is optimized away. *)
| S _ as x -> Obj.magic x
| Concat _ as x -> Obj.magic x
| Dep _ as x -> (x :> any t)
| Deps _ as x -> (x :> any t)
| Path _ as x -> (x :> any t)
Expand Down

0 comments on commit a5e6f97

Please sign in to comment.