Skip to content

Commit

Permalink
Filter -> find
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack Feser committed Sep 8, 2021
1 parent 63de1db commit 1704923
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions ocaml-lsp-server/src/code_actions/action_mark_remove_unused.ml
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,13 @@ let code_action_remove_value doc pos (diagnostic : Diagnostic.t) =
let code_action doc (params : CodeActionParams.t) =
let pos = params.range.start in
let diag =
List.filter params.context.diagnostics ~f:(fun (d : Diagnostic.t) ->
match Position.compare_inclusion pos d.range with
| `Outside _ -> false
| `Inside -> true)
|> List.find ~f:Diagnostic_util.is_unused_var_warning
List.find params.context.diagnostics ~f:(fun (d : Diagnostic.t) ->
let in_range =
match Position.compare_inclusion pos d.range with
| `Outside _ -> false
| `Inside -> true
in
in_range && Diagnostic_util.is_unused_var_warning d)
in
match diag with
| None -> Fiber.return []
Expand Down

0 comments on commit 1704923

Please sign in to comment.