1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
all: check_all test
check_all: lint doc unused_dep typos
test:
cargo test
# Format, then lint exactly as CI does, so `make lint` fails where CI would.
lint:
cargo fmt
cargo clippy --no-deps --all-targets -- -D warnings
@# Bug: clippy --all-targets reports false warning about unused dep in
@# `[dev-dependencies]`:
@# https://github.com/rust-lang/rust/issues/72686#issuecomment-635539688
@# Thus we only check unused deps for lib
RUSTFLAGS=-Wunused-crate-dependencies cargo clippy --no-deps --lib -- -D warnings
fmt:
cargo fmt
doc:
RUSTDOCFLAGS="-D warnings" cargo doc --all --no-deps
check:
RUSTFLAGS="-D warnings" cargo check --all-targets
unused_dep:
# cargo install cargo-machete
cargo machete
typos:
# cargo install typos-cli
typos --write-changes src/ examples/ tests/ README.md
audit:
# cargo install cargo-audit
cargo audit
# Verify the crate packages and publishes cleanly, without uploading.
publish_check:
cargo publish --dry-run
clean:
cargo clean
@# Cluster state the kvstore example writes, relative to where it ran. A
@# stale directory makes the next run come back with the old node id and
@# log instead of forming a fresh cluster. Mirrors the .gitignore entry.
rm -rf data
.PHONY: all check_all test lint fmt doc check unused_dep typos audit publish_check clean