Installing Tools 🛠
These notes are specific and targeted for macOS
Need to install rustup
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Supposed to cut down on compile times.
Brew install then set with .cargo/config.toml
brew install michaeleisel/zld/zld
.cargo/config.toml
# On Windows
# ```
# cargo install -f cargo-binutils
# rustup component add llvm-tools-preview
# ```
[target.x86_64-pc-windows-msvc]
rustflags = ["-C", "link-arg=-fuse-ld=lld"]
[target.x86_64-pc-windows-gnu]
rustflags = ["-C", "link-arg=-fuse-ld=lld"]
# On Linux:
# - Ubuntu, `sudo apt-get install lld clang`
# - Arch, `sudo pacman -S lld clang`
[target.x86_64-unknown-linux-gnu]
rustflags = ["-C", "linker=clang", "-C", "link-arg=-fuse-ld=lld"]
# On MacOS, `brew install michaeleisel/zld/zld`
[target.x86_64-apple-darwin]
rustflags = ["-C", "link-arg=-fuse-ld=/usr/local/bin/zld"]
[target.aarch64-apple-darwin]
rustflags = ["-C", "link-arg=-fuse-ld=/usr/local/bin/zld"]
Cargo Watch watches over your project's source for changes, and runs Cargo commands when they occur.
💭 Kind of like
nodemon
# had to install binstall because other way wasn't working
cargo install cargo-binstall
cargo binstall cargo-watch
# on file change
cargo watch -x check
# on file change: check, test, run
cargo watch -x check -x test -x run
Tarpaulin is a code coverage reporting tool for the Cargo build system, named for a waterproof cloth used to cover cargo on a ship.
Currently, tarpaulin provides working line coverage and while fairly reliable may still contain minor inaccuracies in the results.
cargo install cargo-tarpaulin
cargo tarpaulin --ignore-tests
Clippy is the official linter maintained by the rust team
rustup component add clippy
cargo clippy
# for CI
cargo clippy -- -D warnings