script: cargo: Improve the cargo tests

We don't need to force the cargo-audit install, we can check if it's
already available instead and install if it's not.

Also, since we now have workspaces properly setup, we can call directly
into cargo fmt and avoid calling into find magic incantation.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
Samuel Ortiz 2020-01-30 23:59:11 +01:00 committed by Rob Bradford
parent db6f894e5e
commit 76087f1235

View File

@ -7,7 +7,7 @@ source $HOME/.cargo/env
# Install cargo components
time rustup component add clippy
time rustup component add rustfmt
time cargo install --force cargo-audit
time which cargo-audit || cargo install cargo-audit
# Run cargo builds and checks
time cargo clippy --all-targets --all-features -- -D warnings
@ -24,5 +24,5 @@ time cargo rustc --bin vhost_user_net --no-default-features --features "pci" --
time cargo clippy --all-targets --no-default-features --features "mmio" -- -D warnings
time cargo rustc --bin cloud-hypervisor --no-default-features --features "mmio" -- -D warnings
time cargo rustc --bin vhost_user_net --no-default-features --features "mmio" -- -D warnings
time sh -c 'find . \( -name "*.rs" ! -wholename "*/out/*.rs" \) | xargs rustfmt --check'
time cargo fmt
time cargo build --release