Skip to content

Commit

Permalink
[suppressions] small code improvement
Browse files Browse the repository at this point in the history
Summary: Replaced a sequence of `Map.find` + `Map.add` with `Map.update`.

Reviewed By: martintrojer

Differential Revision: D66353818

fbshipit-source-id: fb28d9ce1cbadd091c8086c3f0a4ebc07f6dcb52
  • Loading branch information
ngorogiannis authored and facebook-github-bot committed Nov 22, 2024
1 parent ed53866 commit 7c872c1
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions infer/src/integration/Suppressions.ml
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,16 @@ let update_suppressions block_start current_line issue_types suppressions =
| Some start ->
IString.Set.fold
(fun issue_type m ->
match IString.Map.find_opt issue_type suppressions with
| None ->
IString.Map.add issue_type (Span.Blocks [{first= start; last= current_line}]) m
| Some (Span.Blocks b) ->
IString.Map.add issue_type
(Span.Blocks (b @ [{Span.first= start; last= current_line}]))
m
| Some Span.Every ->
(* don't override Every with Blocks *)
m )
IString.Map.update issue_type
(function
| None ->
Some (Span.Blocks [{first= start; last= current_line}])
| Some (Span.Blocks b) ->
Some (Span.Blocks (b @ [{Span.first= start; last= current_line}]))
| Some Span.Every as some_every ->
(* don't override Every with Blocks *)
some_every )
m )
issue_types suppressions


Expand Down

0 comments on commit 7c872c1

Please sign in to comment.