All development targets stable.
Install rust as described here.
Then, install rustfmt and clippy, which are required to make sure that changes can pass CI tests (see below):
rustup component add rustfmt clippytarpaulin for calculating test coverage:
cargo install cargo-tarpaulinGitHub actions/work flows handle all CI:
rustfmtchecks code formattingclippychecks for code "lint".- The library is built, and tests are run, against both rust
stableandbeta.
clippy is a very opinionated code "linter".
Any changes must pass all clippy checks.
Some of these checks may seem stylistic, meaning that you are being asked to replace working code with a different implementation.
In these cases clippy is suggesting a more idiomatic approach to do what you are asking.
We accept clippy's recommendations for two reasons.
First, it is best to respect language idioms whenever possible ("don't force rust to act like C or C++").
Second, these recommendations have been useful in learning more about rust.
cargo buildcargo build --examplesAdd --release to any of the above.
This flags adds optimizations and removes debugging symbols.
cargo docThen, point your browser at target/doc/tskit/index.html.
To run tests and doc tests:
cargo testTo test examples:
cargo test --examplesUsing tarpaulin:
cargo tarpaulin --exclude-files '*.c' --exclude-files '*.h' -o htmlWe exclude *.c and *.h because it is tskit's job to manage the coverage of those files.
Some notes on what tarpaulin does:
- The coverage includes the test code itself, which is a bit annoying. In the future, we may move all tests to a separate directory and exclude them from the calculation.
The default build is debug, which makes the examples slow.
To run release builds of examples:
cargo build --release --examplesThe binaries will be in target/release/examples/.
cargo cleanrm -f Cargo.lock