Subject
anstyle-parse is a parser for ANSI / VT terminal escape sequences. It implements Paul Williams' DEC ANSI parser state machine (https://vt100.net/emu/dec_ansi_parser) as a generated 16x256 state-transition table consumed by an iterative Parser that dispatches actions to a user-supplied Perform trait implementation. The crate is #![no_std] outside of tests, with optional utf8 (default) and core features that swap in utf8parse and arrayvec respectively to keep dependencies and allocator usage configurable. The crate is a fork of alacritty/vte, restricted to the parser core. It is the workhorse parser underneath the anstream / clap styling ecosystem.
Methodology
The published crate contents were compared against the upstream Git repository at the commit recorded in .cargo_vcs_info.json using diff -r. The crate is published from crates/anstyle-parse of the rust-cli/anstyle workspace; the symlinked vcs/ directory points at that subdirectory. The published source files (src/lib.rs, src/params.rs, src/state/mod.rs, src/state/definitions.rs, src/state/codegen.rs, src/state/table.rs, ~1380 lines) were read in full apart from the generated transition table, which was spot-checked. The three unsafe sites were located with grep and each was checked against its respective invariants. The upstream tests/testsuite.rs (excluded from the published include) was inspected for context on test coverage and proptest usage.
Results
The comparison between the published crate contents and the upstream Git repository shows that the source files, README.md, and the LICENSE-* files match byte-for-byte. Manifest differences are limited to cargo's standard Cargo.toml normalisation plus the addition of .cargo_vcs_info.json, Cargo.lock, and the preserved Cargo.toml.orig. The upstream tests/, benches/, and CHANGELOG.md are not included in the published crate because the include glob in Cargo.toml covers only src/, Cargo.toml, Cargo.lock, LICENSE*, README.md, examples/, and build.rs (FINDING-2).
The crate ships no binary artefacts, no build.rs, no proc macros, and no install hooks, justifying has-binaries, has-build-exec, and has-install-exec. Inline unit tests live in the source files (3 #[test] functions in src/state/codegen.rs and src/state/definitions.rs), justifying has-unit-tests. The upstream integration test suite at tests/testsuite.rs uses proptest against the Perform trait but is not published, justifying has-integration-tests and has-property-tests at the package level (FINDING-2). There is no fuzz/ directory and no in-source property-test harness, justifying has-fuzz-tests. The package contains no malicious code or deliberately harmful behaviour, justifying is-benign.
The codebase was reviewed for cryptographic libraries (none), network I/O (none), file I/O (none), process execution (none), environment-variable access (none), interpreters or JIT (none), and concurrency primitives (none). The example examples/parselog.rs reads stdin via std::io::Read for demonstration but does not touch the filesystem in the conventional sense; it is not part of the library API. This justifies uses-crypto, uses-network, uses-filesystem, uses-exec, uses-environment, uses-jit, uses-interpreter, uses-concurrency, impl-crypto, impl-interpreter, impl-jit, impl-protocol, impl-datastructure, impl-algorithm, and impl-concurrency.
The crate implements a parser for ANSI escape sequences (justifying impl-parser). The state machine follows the reference VT100 state diagram cited in the lib-level documentation, and the on-disk STATE_CHANGES table at src/state/table.rs is regenerated and byte-compared against the spec defined inline in src/state/codegen.rs by a #[cfg(test)] test (codegen::table). The implementation produces well-typed (State, Action) pairs via state::unpack, and the high-level Parser::advance dispatches actions through the user's Perform impl without panicking on any byte input. This justifies parser-impl-safe and parser-impl-correct. The implementation is a fork of alacritty/vte and inherits that crate's lineage of fuzz/proptest exposure (the upstream test suite, although not shipped, continues to exercise it on the maintainer's side); this together with the 3 in-source tests justifies parser-impl-tested.
unsafe is used in three small sites (justifying uses-unsafe). In src/lib.rs:175-187 (Parser::osc_dispatch), the well-known "array of MaybeUninit" idiom builds a fixed-size temporary, exactly osc_num_params entries are initialised before a slice of that length is cast to &[&[u8]] and passed to the user. In src/state/definitions.rs:116-123 (unpack), mem::transmute converts delta & 0x0f and delta >> 4 to State and Action respectively; both enums are #[repr(u8)] with exactly 16 sequential variants matching the bit width. The transmute pre-conditions are documented in a function-level doc comment, but the two osc_dispatch blocks lack canonical // SAFETY: per-block comments (FINDING-1). The blocks are exercised by the in-source tests and (during development) by the upstream proptest suite. This justifies unsafe-safe, unsafe-minimal, and unsafe-tested, while unsafe-documented is set to false.
Two low-severity quality findings were recorded: FINDING-1 for the partial SAFETY documentation on the unsafe blocks, and FINDING-2 for the publish-time exclusion of the test and benchmark suites (which leaves dev-deps proptest/divan/snapbox non-functional in the published artefact).
Conclusion
anstyle-parse is a focused VT-state-machine parser with a small, well-bounded unsafe surface and a long upstream lineage. The audit found no security, safety, or correctness defects. The two recorded findings are quality observations rather than defects. The package is benign and safe to use.