From f92ad0f78ca11a41d431bad5489b05ceb45bc8a9 Mon Sep 17 00:00:00 2001 From: mulhern Date: Wed, 20 Dec 2023 21:12:22 -0500 Subject: [PATCH] Add clippy Makefile target Fix a few clippy errors Signed-off-by: mulhern --- .github/workflows/ci.yml | 5 +---- Cargo.toml | 3 ++- Makefile | 12 ++++++++++++ build.rs | 2 -- 4 files changed, 15 insertions(+), 7 deletions(-) create mode 100644 Makefile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9942781..74594d3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,7 +60,4 @@ jobs: args: --all -- --check - name: Run cargo clippy - uses: actions-rs/cargo@v1 - with: - command: clippy - args: -- -D warnings + run: make -f Makefile clippy diff --git a/Cargo.toml b/Cargo.toml index a8dc034..08a1a7a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,9 +7,10 @@ license = "MIT" documentation = "https://docs.rs/loopdev-3" repository = "https://github.com/stratis-storage/loopdev-3" readme = "README.md" +categories = ["os::linux-apis", "api-bindings"] keywords = ["loop"] edition = "2021" -exclude = ["/.github", ".gitignore"] +exclude = ["/.github", ".gitignore", "Makefile"] [lib] name = "loopdev" diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..a902b16 --- /dev/null +++ b/Makefile @@ -0,0 +1,12 @@ +ifeq ($(origin CLIPPY_FIX), undefined) + CLIPPY_OPTS = --all-targets --no-deps +else + CLIPPY_OPTS = --fix +endif + +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 + +clippy: + RUSTFLAGS="${DENY}" cargo clippy ${CLIPPY_OPTS} -- ${CLIPPY_DENY} diff --git a/build.rs b/build.rs index 26eb038..c75e915 100644 --- a/build.rs +++ b/build.rs @@ -1,5 +1,3 @@ -extern crate bindgen; - use bindgen::Builder; use std::{env::var, path::PathBuf};