8
8
cargo clean
9
9
rm -f Cargo.lock
10
10
11
- # Update dependencies, including breaking changes
11
+ # Update all dependencies, including the breaking changes. Requires nightly toolchain (install with `rustup install nightly`)
12
12
update :
13
13
cargo + nightly -Z unstable-options update --breaking
14
14
cargo update
15
15
16
16
# Find the minimum supported Rust version (MSRV) using cargo-msrv extension, and update Cargo.toml
17
17
msrv :
18
- cargo msrv find --write-msrv
18
+ cargo msrv find --write-msrv --ignore-lockfile
19
19
20
- # Run cargo clippy
20
+ # Run cargo clippy to lint the code
21
21
clippy :
22
22
cargo clippy --workspace --all-targets -- -D warnings
23
23
cargo clippy --no-default-features --features with-uds -- -D warnings
@@ -26,18 +26,26 @@ clippy:
26
26
test-fmt :
27
27
cargo fmt --all -- --check
28
28
29
- # Run cargo fmt
29
+ # Reformat all code ` cargo fmt`. If nightly is available, use it for better results
30
30
fmt :
31
- cargo + nightly fmt -- --config imports_granularity=Module,group_imports=StdExternalCrate
31
+ #!/usr/bin/env bash
32
+ set -euo pipefail
33
+ if command -v cargo + nightly &> / dev/ null; then
34
+ echo ' Reformatting Rust code using nightly Rust fmt to sort imports'
35
+ cargo + nightly fmt --all -- --config imports_granularity=Module,group_imports=StdExternalCrate
36
+ else
37
+ echo ' Reformatting Rust with the stable cargo fmt. Install nightly with `rustup install nightly` for better results'
38
+ cargo fmt --all
39
+ fi
32
40
33
41
# Build and open code documentation
34
42
docs :
35
43
cargo doc --no-deps --open
36
44
37
- # Quick compile
45
+ # Quick compile without building a binary
38
46
check :
39
- RUSTFLAGS=' -D warnings' cargo check
40
- RUSTFLAGS=' -D warnings' cargo check --no-default-features --features with-uds
47
+ RUSTFLAGS=' -D warnings' cargo check --workspace --all-targets
48
+ RUSTFLAGS=' -D warnings' cargo check --no-default-features --features with-uds --all-targets
41
49
42
50
# Run all tests
43
51
test :
@@ -49,10 +57,11 @@ test:
49
57
50
58
# Test documentation
51
59
test-doc :
52
- cargo test --doc
60
+ RUSTDOCFLAGS= " -D warnings" cargo test --doc
53
61
RUSTDOCFLAGS=" -D warnings" cargo doc --no-deps
54
62
55
- rust-info :
63
+ # Print Rust version information
64
+ @ rust-info :
56
65
rustc --version
57
66
cargo --version
58
67
0 commit comments