diff --git a/src/lib_base/s.ml b/src/lib_base/s.ml index 2885c7237..da02629e7 100644 --- a/src/lib_base/s.ml +++ b/src/lib_base/s.ml @@ -56,18 +56,12 @@ module type SET = sig val partition: (elt -> bool) -> t -> t * t val cardinal: t -> int val elements: t -> elt list - val min_elt: t -> elt val min_elt_opt: t -> elt option - val max_elt: t -> elt val max_elt_opt: t -> elt option - val choose: t -> elt val choose_opt: t -> elt option val split: elt -> t -> t * bool * t - val find: elt -> t -> elt val find_opt: elt -> t -> elt option - val find_first: (elt -> bool) -> t -> elt val find_first_opt: (elt -> bool) -> t -> elt option - val find_last: (elt -> bool) -> t -> elt val find_last_opt: (elt -> bool) -> t -> elt option val of_list: elt list -> t end @@ -95,18 +89,12 @@ module type MAP = sig val partition: (key -> 'a -> bool) -> 'a t -> 'a t * 'a t val cardinal: 'a t -> int val bindings: 'a t -> (key * 'a) list - val min_binding: 'a t -> (key * 'a) val min_binding_opt: 'a t -> (key * 'a) option - val max_binding: 'a t -> (key * 'a) val max_binding_opt: 'a t -> (key * 'a) option - val choose: 'a t -> (key * 'a) val choose_opt: 'a t -> (key * 'a) option val split: key -> 'a t -> 'a t * 'a option * 'a t - val find: key -> 'a t -> 'a val find_opt: key -> 'a t -> 'a option - val find_first: (key -> bool) -> 'a t -> key * 'a val find_first_opt: (key -> bool) -> 'a t -> (key * 'a) option - val find_last: (key -> bool) -> 'a t -> key * 'a val find_last_opt: (key -> bool) -> 'a t -> (key * 'a) option val map: ('a -> 'b) -> 'a t -> 'b t val mapi: (key -> 'a -> 'b) -> 'a t -> 'b t diff --git a/src/lib_protocol_environment/sigs/v1/s.mli b/src/lib_protocol_environment/sigs/v1/s.mli index f3e3fcca0..38e6c4505 100644 --- a/src/lib_protocol_environment/sigs/v1/s.mli +++ b/src/lib_protocol_environment/sigs/v1/s.mli @@ -105,18 +105,12 @@ module type SET = sig val partition: (elt -> bool) -> t -> t * t val cardinal: t -> int val elements: t -> elt list - val min_elt: t -> elt val min_elt_opt: t -> elt option - val max_elt: t -> elt val max_elt_opt: t -> elt option - val choose: t -> elt val choose_opt: t -> elt option val split: elt -> t -> t * bool * t - val find: elt -> t -> elt val find_opt: elt -> t -> elt option - val find_first: (elt -> bool) -> t -> elt val find_first_opt: (elt -> bool) -> t -> elt option - val find_last: (elt -> bool) -> t -> elt val find_last_opt: (elt -> bool) -> t -> elt option val of_list: elt list -> t end @@ -144,18 +138,12 @@ module type MAP = sig val partition: (key -> 'a -> bool) -> 'a t -> 'a t * 'a t val cardinal: 'a t -> int val bindings: 'a t -> (key * 'a) list - val min_binding: 'a t -> (key * 'a) val min_binding_opt: 'a t -> (key * 'a) option - val max_binding: 'a t -> (key * 'a) val max_binding_opt: 'a t -> (key * 'a) option - val choose: 'a t -> (key * 'a) val choose_opt: 'a t -> (key * 'a) option val split: key -> 'a t -> 'a t * 'a option * 'a t - val find: key -> 'a t -> 'a val find_opt: key -> 'a t -> 'a option - val find_first: (key -> bool) -> 'a t -> key * 'a val find_first_opt: (key -> bool) -> 'a t -> (key * 'a) option - val find_last: (key -> bool) -> 'a t -> key * 'a val find_last_opt: (key -> bool) -> 'a t -> (key * 'a) option val map: ('a -> 'b) -> 'a t -> 'b t val mapi: (key -> 'a -> 'b) -> 'a t -> 'b t diff --git a/src/proto_alpha/lib_protocol/src/script_ir_translator.ml b/src/proto_alpha/lib_protocol/src/script_ir_translator.ml index 38dca4f87..83d0c5e45 100644 --- a/src/proto_alpha/lib_protocol/src/script_ir_translator.ml +++ b/src/proto_alpha/lib_protocol/src/script_ir_translator.ml @@ -435,7 +435,7 @@ let empty_map let map_get : type key value. key -> (key, value) map -> value option = fun k (module Box) -> - try Some (Box.OPS.find k (fst Box.boxed)) with Not_found -> None + Box.OPS.find_opt k (fst Box.boxed) let map_update : type a b. a -> b option -> (a, b) map -> (a, b) map diff --git a/src/proto_alpha/lib_protocol/src/vote_storage.ml b/src/proto_alpha/lib_protocol/src/vote_storage.ml index cdd01f1b0..a8f84a5ef 100644 --- a/src/proto_alpha/lib_protocol/src/vote_storage.ml +++ b/src/proto_alpha/lib_protocol/src/vote_storage.ml @@ -15,8 +15,9 @@ let get_proposals ctxt = ~init:Protocol_hash.Map.empty ~f:(fun (proposal, _delegate) acc -> let previous = - try Protocol_hash.Map.find proposal acc - with Not_found -> 0l in + match Protocol_hash.Map.find_opt proposal acc with + | None -> 0l + | Some x -> x in Lwt.return (Protocol_hash.Map.add proposal (Int32.succ previous) acc)) let clear_proposals ctxt =