Another tool for code coverage is called grcov. It is available at https://github.com/mozilla/grcov.
To produce HTML reports with grcov you can either use the built-in way or using the lcov package. The workflow for grcov is as follows:
# Install the tool
cargo install grcov
# Enable the required Rust flags to generate the coverage files
export CARGO_INCREMENTAL=0
export RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off"
# add -Zno-landing-pads if not macos
# grcov requires rust nightly at this time
cargo +nightly test
# generate the html report
grcov ./target/debug/ -s . -t html --llvm --branch --ignore-not-existing -o ./target/debug/coverage/
# open the report
open target/debug/coverage/index.html
It should produce a report like this for you:
