diff --git a/src/core/CCChar.ml b/src/core/CCChar.ml index 04b38d89..991f1bb5 100644 --- a/src/core/CCChar.ml +++ b/src/core/CCChar.ml @@ -13,7 +13,7 @@ let pp_buf = Buffer.add_char let pp = Format.pp_print_char let of_int_exn = Char.chr -let of_int c = try Some (of_int_exn c) with _ -> None +let of_int c = try Some (of_int_exn c) with Invalid_argument _ -> None let to_int = Char.code (*$= diff --git a/src/core/CCFloat.ml b/src/core/CCFloat.ml index de830785..3543308f 100644 --- a/src/core/CCFloat.ml +++ b/src/core/CCFloat.ml @@ -114,7 +114,7 @@ let of_string_exn (a:string) = Stdlib.float_of_string a let of_string (a:string) = Stdlib.float_of_string a let of_string_opt (a:string) = try Some (Stdlib.float_of_string a) - with _ -> None + with Failure _ -> None let random n st = Random.State.float st n diff --git a/src/core/CCIO.ml b/src/core/CCIO.ml index e616f49b..e78e2d8a 100644 --- a/src/core/CCIO.ml +++ b/src/core/CCIO.ml @@ -222,11 +222,7 @@ let with_in_out ?(mode=0o644) ?(flags=[Open_creat]) filename f = let tee funs g () = match g() with | None -> None | Some x as res -> - List.iter - (fun f -> - try f x - with _ -> () - ) funs; + List.iter (fun f -> f x) funs; res (* TODO: lines/unlines: string gen -> string gen *) diff --git a/src/core/CCInt.ml b/src/core/CCInt.ml index 1483dc87..b081561d 100644 --- a/src/core/CCInt.ml +++ b/src/core/CCInt.ml @@ -202,7 +202,7 @@ let to_string = string_of_int let of_string s = try Some (int_of_string s) - with _ -> None + with Failure _ -> None (*$= None (of_string "moo") diff --git a/src/core/CCString.ml b/src/core/CCString.ml index ad49d9b2..9805cea1 100644 --- a/src/core/CCString.ml +++ b/src/core/CCString.ml @@ -589,7 +589,7 @@ let split_on_char c s: _ list = let split ~by s = Split.list_cpy ~by s let compare_versions a b = - let of_int s = try Some (int_of_string s) with _ -> None in + let of_int s = try Some (int_of_string s) with Failure _ -> None in let rec cmp_rec a b = match a(), b() with | None, None -> 0 | Some _, None -> 1