Skip to content

Commit

Permalink
Use match exception to avoid try/with context (#421)
Browse files Browse the repository at this point in the history
  • Loading branch information
AllanBlanchard authored Jun 25, 2023
1 parent d5a654a commit 8134269
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/report/html.ml
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,9 @@ let output_for_source_file
let lines, line_count =
let rec read number acc =
let start_ofs = pos_in in_channel in
try
let line = input_line in_channel in
match input_line in_channel with
| exception End_of_file -> List.rev acc, number - 1
| line ->
let end_ofs = pos_in in_channel in
let before, after = Util.split (fun (o, _) -> o < end_ofs) !pts in
pts := after;
Expand All @@ -353,8 +354,6 @@ let output_for_source_file
before
in
read (number + 1) ((number, line', visited, unvisited)::acc)

with End_of_file -> List.rev acc, number - 1
in
read 1 []
in
Expand Down

0 comments on commit 8134269

Please sign in to comment.