Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Cargo.toml to specify lint policy #929

Merged
merged 1 commit into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,20 @@ path = "./devicemapper-rs-sys"
semver = "1.0.0"

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = [
warnings = { level = "deny" }
future_incompatible = { level = "deny", priority = 1 }
unused = { level = "deny", priority = 2}
rust_2018_idioms = { level = "deny", priority = 3 }
nonstandard_style = { level = "deny", priority = 4 }
unexpected_cfgs = { level = "deny", check-cfg = [
'cfg(devicemapper41supported)',
'cfg(devicemapper42supported)',
'cfg(devicemapper437supported)',
'cfg(devicemapper441supported)',
'cfg(devicemapper46supported)'
] }

[lints.clippy]
all = { level = "deny" }
cargo = { level = "deny" , priority = 1}
multiple-crate-versions = { level = "allow", priority = 2 }
24 changes: 8 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ endif

IGNORE_ARGS ?=

DENY = -D warnings -D future-incompatible -D unused -D rust_2018_idioms -D nonstandard_style

CLIPPY_DENY = -D clippy::all -D clippy::cargo -A clippy::multiple-crate-versions

audit:
cargo audit -D warnings

Expand All @@ -32,9 +28,9 @@ test-set-lower-bounds:
test -e "${SET_LOWER_BOUNDS}"

verify-dependency-bounds: test-set-lower-bounds
RUSTFLAGS="${DENY}" cargo build ${MANIFEST_PATH_ARGS}
cargo build ${MANIFEST_PATH_ARGS}
${SET_LOWER_BOUNDS} ${MANIFEST_PATH_ARGS}
RUSTFLAGS="${DENY}" cargo build ${MANIFEST_PATH_ARGS}
cargo build ${MANIFEST_PATH_ARGS}

test-compare-fedora-versions:
echo "Testing that COMPARE_FEDORA_VERSIONS environment variable is set to a valid path"
Expand All @@ -52,24 +48,20 @@ fmt-ci:
cd devicemapper-rs-sys && cargo fmt -- --check

build:
RUSTFLAGS="${DENY}" cargo build
cargo build

build-tests:
RUSTFLAGS="${DENY}" cargo test --no-run
cargo test --no-run

test:
RUSTFLAGS="${DENY}" RUST_BACKTRACE=1 cargo test -- --skip sudo_ --skip loop_
RUST_BACKTRACE=1 cargo test -- --skip sudo_ --skip loop_

sudo_test:
RUSTFLAGS="${DENY}" RUST_BACKTRACE=1 RUST_TEST_THREADS=1 CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER='sudo -E' cargo test
RUST_BACKTRACE=1 RUST_TEST_THREADS=1 CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER='sudo -E' cargo test

clippy:
RUSTFLAGS="${DENY}" \
cargo clippy --all-features ${CLIPPY_OPTS} -- \
${CLIPPY_DENY}
cd devicemapper-rs-sys && RUSTFLAGS="${DENY}" \
cargo clippy --all-features ${CLIPPY_OPTS} -- \
${CLIPPY_DENY}
cargo clippy --all-features ${CLIPPY_OPTS}
(cd devicemapper-rs-sys && cargo clippy --all-features ${CLIPPY_OPTS})

docs:
cargo doc --no-deps
Expand Down
12 changes: 12 additions & 0 deletions devicemapper-rs-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,15 @@ categories = ["os::linux-apis", "external-ffi-bindings"]
default-features = false
features = ["runtime"]
version = "0.69.0"

[lints.rust]
warnings = { level = "deny" }
future_incompatible = { level = "deny", priority = 1 }
unused = { level = "deny", priority = 2}
rust_2018_idioms = { level = "deny", priority = 3 }
nonstandard_style = { level = "deny", priority = 4 }

[lints.clippy]
all = { level = "deny" }
cargo = { level = "deny" , priority = 1}
multiple-crate-versions = { level = "allow", priority = 2 }
Loading