Skip to content

Commit d6e235d

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

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,6 +1,14 @@
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
@@ -9,15 +17,11 @@ include struct
917
module Fpath = Path
1018
module Int = Int
1119
module Table = Table
12-
module Tuple = Tuple
1320
module Unix_env = Env
1421
module Io = Io
1522
module Map = Map
1623
module Monoid = Monoid
1724
module Pid = Pid
18-
module Poly = Poly
19-
20-
let sprintf = sprintf
2125
end
2226

2327
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)