Skip to content

Commit

Permalink
cargo: enable ‘-D warnings’ by default
Browse files Browse the repository at this point in the history
Making ‘-D warnings’ the default may be a minor annoyence to developers
who now will need to fix warnings even while they work on the feature
(as opposed to only having to do that once they are ready to send the
code for review) but it does simplify the code a small amount.

Issue: near#6226
  • Loading branch information
mina86 committed Feb 7, 2022
1 parent 1943b85 commit 0dbe7a3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
24 changes: 12 additions & 12 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ steps:
- label: "cargo test integration-tests*"
command: |
source ~/.cargo/env && set -eux
RUST_BACKTRACE=1 RUSTFLAGS='-D warnings' cargo test --locked -p 'integration-tests'
RUST_BACKTRACE=1 cargo test --locked -p 'integration-tests'
timeout: 60
agents:
Expand All @@ -12,7 +12,7 @@ steps:
- label: "cargo test not integration-tests*"
command: |
source ~/.cargo/env && set -eux
RUST_BACKTRACE=1 RUSTFLAGS='-D warnings' cargo test --locked --workspace -p '*' --exclude 'integration-tests*'
RUST_BACKTRACE=1 cargo test --locked --workspace -p '*' --exclude 'integration-tests*'
timeout: 60
agents:
Expand All @@ -22,7 +22,7 @@ steps:
- label: "cargo test nightly integration-tests*"
command: |
source ~/.cargo/env && set -eux
RUST_BACKTRACE=1 RUSTFLAGS='-D warnings' cargo test --features nightly_protocol,nightly_protocol_features,test_features -p 'integration-tests'
RUST_BACKTRACE=1 cargo test --features nightly_protocol,nightly_protocol_features,test_features -p 'integration-tests'
timeout: 60
agents:
Expand All @@ -32,7 +32,7 @@ steps:
- label: "cargo test nightly not integration-tests*"
command: |
source ~/.cargo/env && set -eux
RUST_BACKTRACE=1 RUSTFLAGS='-D warnings' cargo test --workspace --features nightly_protocol,nightly_protocol_features,test_features,rosetta_rpc -p '*' --exclude 'integration-tests*'
RUST_BACKTRACE=1 cargo test --workspace --features nightly_protocol,nightly_protocol_features,test_features,rosetta_rpc -p '*' --exclude 'integration-tests*'
timeout: 60
agents:
Expand All @@ -43,15 +43,15 @@ steps:
command: |
source ~/.cargo/env && set -eux
rustc --version && cargo --version
RUSTFLAGS='-D warnings' cargo run -p themis --release
cargo run -p themis --release
if [ -e deny.toml ]; then
cargo-deny --all-features check bans
fi
RUSTFLAGS='-D warnings' cargo check --workspace --all-targets --all-features
RUSTFLAGS='-D warnings' cargo check -p neard --features test_features
RUSTFLAGS='-D warnings' cargo check -p neard --features sandbox
cargo check --workspace --all-targets --all-features
cargo check -p neard --features test_features
cargo check -p neard --features sandbox
RUSTFLAGS='-D warnings' cargo build -p neard --bin neard --features nightly_protocol,nightly_protocol_features
cargo build -p neard --bin neard --features nightly_protocol,nightly_protocol_features
cd pytest
python3 -m pip install --user -r requirements.txt
python3 tests/sanity/spin_up_cluster.py
Expand All @@ -60,7 +60,7 @@ steps:
# because spinning up non-nightly clusters is already covered
# by other steps in the CI, e.g. upgradable.
RUSTFLAGS='-D warnings' cargo build -p neard --bin neard
cargo build -p neard --bin neard
python3 scripts/state/update_res.py check
python3 scripts/check_nightly.py
Expand All @@ -70,7 +70,7 @@ steps:
./scripts/formatting --check
rm target/rpc_errors_schema.json
RUSTFLAGS='-D warnings' cargo check -p near-jsonrpc --features dump_errors_schema
cargo check -p near-jsonrpc --features dump_errors_schema
if ! git --no-pager diff --no-index chain/jsonrpc/res/rpc_errors_schema.json target/rpc_errors_schema.json; then
set +x
echo 'The RPC errors schema reflects outdated typing structure; please run'
Expand Down Expand Up @@ -134,7 +134,7 @@ steps:
cd runtime/runtime-params-estimator/test-contract
./build.sh
cd ..
RUSTFLAGS='-D warnings' cargo run --release --package runtime-params-estimator --bin runtime-params-estimator -- --accounts-num 20000 --additional-accounts-num 200000 --iters 1 --warmup-iters 1 --metric time
cargo run --release --package runtime-params-estimator --bin runtime-params-estimator -- --accounts-num 20000 --additional-accounts-num 200000 --iters 1 --warmup-iters 1 --metric time
branches: "!master !beta !stable"
timeout: 60
Expand Down
2 changes: 2 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[build]
rustflags = ['-D', 'warnings']
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
export CARGO_PROFILE_RELEASE_CODEGEN_UNITS = 1
export CARGO_PROFILE_RELEASE_LTO = fat
export DOCKER_BUILDKIT = 1
export RUSTFLAGS = -D warnings
export NEAR_RELEASE_BUILD = no
export CARGO_TARGET_DIR = target

Expand Down

0 comments on commit 0dbe7a3

Please sign in to comment.