Skip to content

Commit 164b990

Browse files
committed
ci: Fix lints
We were missing the lint setup between the main kit crate and the workspace. Fix up the resulting warnings. Signed-off-by: Colin Walters <walters@verbum.org>
1 parent cfbf3ab commit 164b990

15 files changed

Lines changed: 59 additions & 7 deletions

File tree

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
uses: Swatinem/rust-cache@v2
4949

5050
- name: Build
51-
run: just check && just build
51+
run: just validate && just build
5252

5353
- name: Run unit tests
5454
run: just unit

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ unused_must_use = "forbid"
2121
missing_docs = "deny"
2222
missing_debug_implementations = "deny"
2323
# Feel free to comment this one out locally during development of a patch.
24+
unused_imports = "deny"
2425
dead_code = "deny"
2526

2627
[workspace.lints.clippy]

Justfile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
build:
33
make
44

5-
# Quick checks
6-
check:
7-
cargo t --workspace --no-run
8-
cargo fmt --check
5+
# Static checks
6+
validate:
7+
make validate
98

109
# Run unit tests (excludes integration tests)
1110
unit *ARGS:

Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,19 @@ manpages: sync-cli-options $(MAN8_TARGETS)
3636
sync-cli-options:
3737
@cargo xtask sync-manpages >/dev/null 2>&1 || true
3838

39+
# This gates CI by default. Note that for clippy, we gate on
40+
# only the clippy correctness and suspicious lints, plus a select
41+
# set of default rustc warnings.
42+
# We intentionally don't gate on this for local builds in cargo.toml
43+
# because it impedes iteration speed.
44+
CLIPPY_CONFIG = -A clippy::all -D clippy::correctness -D clippy::suspicious -D clippy::disallowed-methods -Dunused_imports -Ddead_code
45+
validate:
46+
cargo fmt -- --check -l
47+
cargo test --no-run --workspace
48+
cargo clippy -- $(CLIPPY_CONFIG)
49+
env RUSTDOCFLAGS='-D warnings' cargo doc --lib
50+
.PHONY: validate
51+
3952
install:
4053
install -D -m 0755 -t $(DESTDIR)$(prefix)/bin target/release/bcvk
4154
if [ -n "$(MAN8_TARGETS)" ]; then \

crates/integration-tests/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,6 @@ uuid = { version = "1.18.1", features = ["v4"] }
3333
camino = "1.1.12"
3434
regex = "1"
3535
linkme = "0.3.30"
36+
37+
[lints]
38+
workspace = true

crates/integration-tests/src/bin/cleanup.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
//! Cleanup utility for integration test resources
2+
//!
3+
//! This binary removes integration test containers and libvirt VMs that were created during testing.
4+
15
use std::process::Command;
26

37
// Import shared constants from the library

crates/integration-tests/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,14 @@ pub type TestFn = fn() -> color_eyre::Result<()>;
2020
/// Metadata for a registered integration test
2121
#[derive(Debug)]
2222
pub struct IntegrationTest {
23+
/// Name of the integration test
2324
pub name: &'static str,
25+
/// Test function to execute
2426
pub f: TestFn,
2527
}
2628

2729
impl IntegrationTest {
30+
/// Create a new integration test with the given name and function
2831
pub const fn new(name: &'static str, f: TestFn) -> Self {
2932
Self { name, f }
3033
}

crates/integration-tests/src/main.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Integration tests for bcvk
2+
13
use camino::Utf8Path;
24
use std::process::Output;
35

crates/kit/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,5 @@ similar-asserts = "1.5"
5757
# Implementation detail of man page generation.
5858
docgen = ["clap_mangen"]
5959

60+
[lints]
61+
workspace = true

crates/kit/src/libvirt/list_volumes.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,6 @@ impl LibvirtListVolumesOpts {
344344
}
345345
}
346346

347-
/// Extract value from XML element (simple string parsing)
348-
349347
/// Parse virsh size format (e.g., "5.00 GiB") to bytes
350348
fn parse_virsh_size(size_str: &str) -> Option<u64> {
351349
let parts: Vec<&str> = size_str.split_whitespace().collect();

0 commit comments

Comments
 (0)