remove unnecessary exception match

This commit is contained in:
Rhiannon Morris 2020-12-05 15:12:50 +01:00
parent c6ba203526
commit da551ffe25
1 changed files with 2 additions and 3 deletions

View File

@ -105,9 +105,8 @@ module Validators = struct
let year_range lo hi x =
x =~? {|^\d{4}$|} &&
match int_of_string x with
| exception Invalid_argument _ -> false
| x -> x >= lo && x <= hi
let x = int_of_string x in
x >= lo && x <= hi
let%test _ = year_range 1900 2000 "1950"
let%test _ = year_range 1900 2000 "1900"