Skip to content

Commit 1f0ea85

Browse files
panglesdjonludlam
authored andcommitted
Autoreview comments
- Remove now unused added utils function - Simplified some code - Removed formatting changes in otherwise unchanged cppo-ed files - promote mdx tests Signed-off-by: Paul-Elliot <[email protected]>
1 parent 0d211ce commit 1f0ea85

File tree

5 files changed

+18
-31
lines changed

5 files changed

+18
-31
lines changed

src/document/utils.ml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
let option_of_result = function Result.Ok x -> Some x | Result.Error _ -> None
22

3-
let filter_map f =
4-
let rec aux accu = function
5-
| [] -> List.rev accu
6-
| x :: l -> (
7-
match f x with None -> aux accu l | Some v -> aux (v :: accu) l)
8-
in
9-
aux []
10-
113
let rec flatmap ?sep ~f = function
124
| [] -> []
135
| [ x ] -> f x

src/document/utils.mli

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
val filter_map : ('a -> 'b option) -> 'a list -> 'b list
21
val option_of_result : ('a, 'b) Result.result -> 'a option
32
val flatmap : ?sep:'a list -> f:('b -> 'a list) -> 'b list -> 'a list
43
val skip_until : p:('a -> bool) -> 'a list -> 'a list

src/html/html_page.ml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,9 @@ let html_of_search () =
3939
div ~a:[ a_class [ "search-inner" ] ] [ search_bar; snake; search_result ])
4040

4141
let sidebar toc =
42-
let toc, has_toc =
43-
match toc with
44-
| [] -> ([], false)
45-
| _ ->
46-
([ Html.nav ~a:[ Html.a_class [ "odoc-toc" ] ] (html_of_toc toc) ], true)
47-
in
48-
if has_toc then toc else []
42+
match toc with
43+
| [] -> []
44+
| _ -> [ Html.nav ~a:[ Html.a_class [ "odoc-toc" ] ] (html_of_toc toc) ]
4945

5046
let html_of_breadcrumbs (breadcrumbs : Types.breadcrumb list) =
5147
let make_navigation ~up_url rest =

src/loader/odoc_loader.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,14 @@ let read_cmt ~make_root ~parent ~filename ~source_id_opt () =
164164
in
165165
let content = Odoc_model.Lang.Compilation_unit.Pack items in
166166
make_compilation_unit ~make_root ~imports ~interface ~sourcefile ~name
167-
~id ~source_info:None content
167+
~id ~source_info:None content
168168
| Implementation impl ->
169169
let id, sg, canonical = Cmt.read_implementation parent name impl in
170170
let shape_info, source_info =
171171
read_cmt_infos source_id_opt id ~filename ()
172172
in
173173
compilation_unit_of_sig ~make_root ~imports ~interface ~sourcefile
174-
~name ~id ?canonical ?shape_info ~source_info sg
174+
~name ~id ?canonical ?shape_info ~source_info sg
175175
| _ -> raise Not_an_implementation)
176176

177177
let read_cmi ~make_root ~parent ~filename () =

test/xref2/resolve/test.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ Simplest possible resolution:
144144
representation = None})];
145145
compiled = true; doc = []};
146146
expansion = None; linked = false; canonical = None; source_info = None;
147-
shape_info = None; search_assets = []}
147+
shape_info = None}
148148
```
149149

150150
Let's look at a marginally more complicated example. In this case, our type `t`
@@ -318,7 +318,7 @@ Basic resolution 2, environment lookup:
318318
representation = None})];
319319
compiled = true; doc = []};
320320
expansion = None; linked = false; canonical = None; source_info = None;
321-
shape_info = None; search_assets = []}
321+
shape_info = None}
322322
```
323323

324324

@@ -521,7 +521,7 @@ Basic resolution 3, module type:
521521
...];
522522
compiled = ...; doc = ...};
523523
expansion = ...; linked = ...; canonical = ...; source_info = ...;
524-
shape_info = ...; search_assets = ...}
524+
shape_info = ...}
525525
```
526526

527527
This example is very similar but there is one more level of nesting of the modules:
@@ -724,7 +724,7 @@ Basic resolution 4, module type:
724724
...];
725725
compiled = ...; doc = ...};
726726
expansion = ...; linked = ...; canonical = ...; source_info = ...;
727-
shape_info = ...; search_assets = ...}
727+
shape_info = ...}
728728
```
729729

730730
This example is rather more interesting:
@@ -960,7 +960,7 @@ and then we can look up the type `t`.
960960
...];
961961
compiled = ...; doc = ...};
962962
expansion = ...; linked = ...; canonical = ...; source_info = ...;
963-
shape_info = ...; search_assets = ...}
963+
shape_info = ...}
964964
```
965965

966966
```ocaml
@@ -1167,7 +1167,7 @@ and then we can look up the type `t`.
11671167
...];
11681168
compiled = ...; doc = ...};
11691169
expansion = ...; linked = ...; canonical = ...; source_info = ...;
1170-
shape_info = ...; search_assets = ...}
1170+
shape_info = ...}
11711171
```
11721172

11731173
Ensure a substitution is taken into account during resolution:
@@ -1350,7 +1350,7 @@ Ensure a substitution is taken into account during resolution:
13501350
...];
13511351
compiled = ...; doc = ...};
13521352
expansion = ...; linked = ...; canonical = ...; source_info = ...;
1353-
shape_info = ...; search_assets = ...}
1353+
shape_info = ...}
13541354
```
13551355

13561356
Ensure a destructive substitution is taken into account during resolution:
@@ -1533,7 +1533,7 @@ Ensure a destructive substitution is taken into account during resolution:
15331533
...];
15341534
compiled = ...; doc = ...};
15351535
expansion = ...; linked = ...; canonical = ...; source_info = ...;
1536-
shape_info = ...; search_assets = ...}
1536+
shape_info = ...}
15371537
```
15381538

15391539
Resolve a module alias:
@@ -1694,7 +1694,7 @@ Resolve a module alias:
16941694
representation = None})];
16951695
compiled = true; doc = ...};
16961696
expansion = ...; linked = ...; canonical = ...; source_info = ...;
1697-
shape_info = ...; search_assets = ...}
1697+
shape_info = ...}
16981698
```
16991699

17001700
Resolve a module alias:
@@ -1854,7 +1854,7 @@ Resolve a module alias:
18541854
...];
18551855
compiled = ...; doc = ...};
18561856
expansion = ...; linked = ...; canonical = ...; source_info = ...;
1857-
shape_info = ...; search_assets = ...}
1857+
shape_info = ...}
18581858
```
18591859

18601860
Resolve a functor:
@@ -2036,7 +2036,7 @@ Resolve a functor:
20362036
...];
20372037
compiled = ...; doc = ...};
20382038
expansion = ...; linked = ...; canonical = ...; source_info = ...;
2039-
shape_info = ...; search_assets = ...}
2039+
shape_info = ...}
20402040
```
20412041

20422042
Resolve a functor:
@@ -2243,7 +2243,7 @@ Resolve a functor:
22432243
...];
22442244
compiled = ...; doc = ...};
22452245
expansion = ...; linked = ...; canonical = ...; source_info = ...;
2246-
shape_info = ...; search_assets = ...}
2246+
shape_info = ...}
22472247
```
22482248

22492249
```ocaml skip
@@ -2460,5 +2460,5 @@ Functor app nightmare:
24602460
...];
24612461
compiled = ...; doc = ...};
24622462
expansion = ...; linked = ...; canonical = ...; source_info = ...;
2463-
shape_info = ...; search_assets = ...}
2463+
shape_info = ...}
24642464
```

0 commit comments

Comments
 (0)