commit
1c28d737e5
13
bin/main.ml
13
bin/main.ml
|
@ -181,9 +181,10 @@ let find_root () =
|
|||
List.fold_left l ~init:max_int ~f:(fun acc (prio, _, _) ->
|
||||
min acc prio)
|
||||
in
|
||||
match List.find l ~f:(fun (prio, _, _) -> prio = lowest_priority) with
|
||||
| None -> assert false
|
||||
| Some (_, dir, to_cwd) -> (dir, to_cwd)
|
||||
let (_, dir, to_cwd) =
|
||||
List.find_exn l ~f:(fun (prio, _, _) -> prio = lowest_priority)
|
||||
in
|
||||
(dir, to_cwd)
|
||||
|
||||
let package_name =
|
||||
Arg.conv ((fun p -> Ok (Package.Name.of_string p)), Package.Name.pp)
|
||||
|
@ -896,11 +897,7 @@ let external_lib_deps =
|
|||
in
|
||||
if only_missing then begin
|
||||
let context =
|
||||
match
|
||||
List.find setup.contexts ~f:(fun c -> c.name = context_name)
|
||||
with
|
||||
| None -> assert false
|
||||
| Some c -> c
|
||||
List.find_exn setup.contexts ~f:(fun c -> c.name = context_name)
|
||||
in
|
||||
let missing =
|
||||
String.Map.filteri externals ~f:(fun name _ ->
|
||||
|
|
|
@ -160,9 +160,9 @@ module Internal_rule = struct
|
|||
last_requested_file :: acc
|
||||
else
|
||||
let requested_file, rev_dep =
|
||||
Option.value_exn
|
||||
(List.find t.rev_deps ~f:(fun (_, t) ->
|
||||
Id.Set.mem t.transitive_rev_deps last.id))
|
||||
List.find_exn
|
||||
t.rev_deps
|
||||
~f:(fun (_, t) -> Id.Set.mem t.transitive_rev_deps last.id)
|
||||
in
|
||||
build_loop (requested_file :: acc) rev_dep
|
||||
in
|
||||
|
|
|
@ -77,6 +77,11 @@ let rec find l ~f =
|
|||
| [] -> None
|
||||
| x :: l -> if f x then Some x else find l ~f
|
||||
|
||||
let find_exn l ~f =
|
||||
match find l ~f with
|
||||
| Some x -> x
|
||||
| None -> invalid_arg "List.find_exn"
|
||||
|
||||
let rec last = function
|
||||
| [] -> None
|
||||
| [x] -> Some x
|
||||
|
|
|
@ -28,6 +28,7 @@ val rev_filter_partition_map
|
|||
-> 'b t * 'c t
|
||||
|
||||
val find : 'a t -> f:('a -> bool ) -> 'a option
|
||||
val find_exn : 'a t -> f:('a -> bool ) -> 'a
|
||||
val find_map : 'a t -> f:('a -> 'b option) -> 'b option
|
||||
|
||||
val last : 'a t -> 'a option
|
||||
|
|
Loading…
Reference in New Issue