set positional-arguments
review: check-format no-inline-tests check clippy test
it *args='':
cargo run --bin it "$@"
no-inline-tests:
#!/usr/bin/env bash
if grep -r '#\[test\]' src/ 2>/dev/null; then
echo "Error: #[test] found outside tests directory"
exit 1
else
echo "No inline tests"
fi
check:
#!/usr/bin/env bash
output=$(cargo check --all-targets 2>&1)
if [ $? -eq 0 ]; then
echo "Check passed"
else
echo "$output"
exit 1
fi
check-verbose:
cargo check --all-targets
build:
#!/usr/bin/env bash
output=$(cargo build --all-targets 2>&1)
if [ $? -eq 0 ]; then
echo "Build passed"
else
echo "$output"
exit 1
fi
build-verbose:
cargo build --all-targets
test:
#!/usr/bin/env bash
output=$(cargo test 2>&1)
if [ $? -eq 0 ]; then
echo "Tests passed"
else
echo "$output"
exit 1
fi
test-verbose:
cargo test
clippy:
#!/usr/bin/env bash
output=$(cargo clippy --all-targets -- -D warnings -D clippy::all 2>&1)
if [ $? -eq 0 ]; then
echo "Clippy passed"
else
echo "$output"
exit 1
fi
clippy-verbose:
cargo clippy --all-targets -- -D warnings -D clippy::all
fmt:
cargo +nightly fmt
check-format:
#!/usr/bin/env bash
output=$(cargo +nightly fmt -- --check 2>&1)
if [ $? -eq 0 ]; then
echo "Format OK"
else
echo "$output"
exit 1
fi
check-format-verbose:
cargo +nightly fmt -- --check
clean:
cargo clean