Skip to main content

Module producers

Module producers 

Source
Expand description

Reusable Producer implementations for common cargo subcommands.

Each producer spawns a cargo subprocess, captures its output, and converts the result into a Report. Subprocess failures (missing cargo, non-zero exit, parse errors) become a CheckResult::fail inside the produced report rather than panicking.

§Available producers

FunctionSubcommandMapping
cargo_test_producercargo testEach test → one CheckResult (pass / fail+Error / skip for ignored).
clippy_producercargo clippyEach diagnostic → one CheckResult (warning → warn, error → fail).
cargo_check_producercargo checkEach diagnostic → one CheckResult (same mapping as clippy).

Both clippy and cargo check parse --message-format=json. The producers do NOT escalate warnings to errors (no -D warnings); the distinction is preserved in the produced CheckResult verdicts.

§Environment

CARGO_TARGET_DIR, CARGO, and the rest of the parent environment are inherited by the subprocess. Callers that need a clean environment should configure one before constructing the producer.

Structs§

CargoCheckProducer
Producer that runs cargo check --message-format=json and maps each compiler diagnostic to one CheckResult.
CargoTestProducer
Producer that runs cargo test --no-fail-fast and maps libtest’s human-readable output to one CheckResult per test.
ClippyProducer
Producer that runs cargo clippy --message-format=json and maps each compiler diagnostic to one CheckResult.

Functions§

cargo_check_producer
Build a producer that runs cargo check --message-format=json.
cargo_test_producer
Build a producer that runs cargo test --no-fail-fast and emits one CheckResult per test.
clippy_producer
Build a producer that runs cargo clippy --message-format=json.