Skip to content

Commit e368d44

Browse files
committed
justfile cleanup
1 parent e15b87d commit e368d44

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

justfile

+19-10
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ clean:
88
cargo clean
99
rm -f Cargo.lock
1010

11-
# Update dependencies, including breaking changes
11+
# Update all dependencies, including the breaking changes. Requires nightly toolchain (install with `rustup install nightly`)
1212
update:
1313
cargo +nightly -Z unstable-options update --breaking
1414
cargo update
1515

1616
# Find the minimum supported Rust version (MSRV) using cargo-msrv extension, and update Cargo.toml
1717
msrv:
18-
cargo msrv find --write-msrv
18+
cargo msrv find --write-msrv --ignore-lockfile
1919

20-
# Run cargo clippy
20+
# Run cargo clippy to lint the code
2121
clippy:
2222
cargo clippy --workspace --all-targets -- -D warnings
2323
cargo clippy --no-default-features --features with-uds -- -D warnings
@@ -26,18 +26,26 @@ clippy:
2626
test-fmt:
2727
cargo fmt --all -- --check
2828

29-
# Run cargo fmt
29+
# Reformat all code `cargo fmt`. If nightly is available, use it for better results
3030
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
3240

3341
# Build and open code documentation
3442
docs:
3543
cargo doc --no-deps --open
3644

37-
# Quick compile
45+
# Quick compile without building a binary
3846
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
4149

4250
# Run all tests
4351
test:
@@ -49,10 +57,11 @@ test:
4957

5058
# Test documentation
5159
test-doc:
52-
cargo test --doc
60+
RUSTDOCFLAGS="-D warnings" cargo test --doc
5361
RUSTDOCFLAGS="-D warnings" cargo doc --no-deps
5462

55-
rust-info:
63+
# Print Rust version information
64+
@rust-info:
5665
rustc --version
5766
cargo --version
5867

0 commit comments

Comments
 (0)