Skip to content

Commit 8161282

Browse files
committed
refactor: remove more stdune cruft
Signed-off-by: Rudi Grinberg <[email protected]> <!-- ps-id: 66324ec5-3557-4523-9d4a-6f6906e633a8 --> Signed-off-by: Rudi Grinberg <[email protected]>
1 parent ef898fb commit 8161282

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

ocaml-lsp-server/src/import.ml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
11
(* All modules from [Stdune] should be in the struct below. The modules are
22
listed alphabetically. Try to keep the order. *)
33

4+
module Poly = struct
5+
let equal = ( = )
6+
let compare x y = Ordering.of_int (compare x y)
7+
let hash x = Hashtbl.hash x
8+
end
9+
10+
let sprintf = Printf.sprintf
11+
412
include struct
513
open Stdune
614
module Code_error = Code_error
715
module Comparable = Comparable
816
module Exn_with_backtrace = Exn_with_backtrace
917
module Int = Int
1018
module Table = Table
11-
module Tuple = Tuple
1219
module Unix_env = Env
1320
module Io = Io
1421
module Map = Map
1522
module Monoid = Monoid
1623
module Pid = Pid
17-
module Poly = Poly
18-
19-
let sprintf = sprintf
2024
end
2125

2226
include struct

ocaml-lsp-server/src/position.ml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,7 @@ let ( - ) ({ line; character } : t) (t : t) : t =
3737
;;
3838

3939
let abs ({ line; character } : t) : t = { line = abs line; character = abs character }
40-
41-
let compare ({ line; character } : t) (t : t) : Ordering.t =
42-
Stdune.Tuple.T2.compare Int.compare Int.compare (line, character) (t.line, t.character)
43-
;;
40+
let compare (x : t) (t : t) : Ordering.t = Poly.compare x t
4441

4542
let compare_inclusion (t : t) (r : Lsp.Types.Range.t) =
4643
match compare t r.start, compare t r.end_ with

ocaml-lsp-server/src/range.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ let contains (x : t) (y : t) =
2222
let compare_size (x : t) (y : t) =
2323
let dx = Position.(x.end_ - x.start) in
2424
let dy = Position.(y.end_ - y.start) in
25-
Tuple.T2.compare Int.compare Int.compare (dx.line, dy.line) (dx.character, dy.character)
25+
Poly.compare (dx.line, dy.line) (dx.character, dy.character)
2626
;;
2727

2828
let first_line =

0 commit comments

Comments
 (0)