Streaming opam file codec for OCaml
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

wal, block, sse, zephyr: remove [mutable] from never-reassigned fields

Warning 69 (unused-field, mutable-never-assigned). Four independent
record fields were flagged as mutable but the code only mutates their
referents in place, never rebinds the record slot itself:

- ocaml-wal/lib/wal.ml: [t.file] (the Eio file resource; methods call
Eio.File.pwrite_all etc., the slot is set once at open time).
- ocaml-block/lib/block.ml: [Memory.state.data] (the backing bytes,
written via Bytes.blit_string; [Bytes.t] is already mutable).
- ocaml-sse/lib/sse.ml: [Parser.t.data_buf] (a Buffer.t, written via
Buffer.add_*; the slot never changes).
- ocaml-zephyr/lib/zephyr.ml: drop [mode : Read | Write] entirely —
set at open-time, read nowhere. The open_read / open_write
constructors already distinguish the two call shapes, so mode
tracking was redundant.

+7 -4
+3
dune
··· 1 + (env 2 + (dev 3 + (flags :standard %{dune-warnings})))
+2 -2
lib/codec.mli
··· 32 32 (** [list c] is the homogeneous-list codec over [c]. *) 33 33 34 34 val option : 'a t -> 'a option t 35 - (** [option c] wraps decoded values in [Some]; [None] encodes as the empty 36 - list. *) 35 + (** [option c] wraps decoded values in [Some]; [None] encodes as the empty list. 36 + *) 37 37 38 38 val map : ?kind:string -> dec:('a -> 'b) -> enc:('b -> 'a) -> 'a t -> 'b t 39 39 (** [map ~dec ~enc c] transforms codec [c] through the given functions. *)
+2 -2
test/test_codec.ml
··· 3 3 SPDX-License-Identifier: ISC 4 4 ---------------------------------------------------------------------------*) 5 5 6 - (** Tests for {!Opam.Codec}. The heavy integration tests live in 7 - {!Test_opam}; these verify the combinators in isolation. *) 6 + (** Tests for {!Opam.Codec}. The heavy integration tests live in {!Test_opam}; 7 + these verify the combinators in isolation. *) 8 8 9 9 let test_bool_kind () = 10 10 Alcotest.(check string) "bool kind" "bool" (Opam.Codec.kind Opam.Codec.bool)