Skip to content

fix(ci): clear RUSTFLAGS=-D warnings lints + cargo fmt sweep#1

Merged
Laffinty merged 1 commit into
mainfrom
fix/ci-lint-cleanup
Jun 6, 2026
Merged

fix(ci): clear RUSTFLAGS=-D warnings lints + cargo fmt sweep#1
Laffinty merged 1 commit into
mainfrom
fix/ci-lint-cleanup

Conversation

@Laffinty
Copy link
Copy Markdown
Owner

@Laffinty Laffinty commented Jun 6, 2026

CI was failing on commit 0ea6200 (M2-M6) with build errors on all three platforms. Two of the steps ('Build workspace' and 'Run unit tests') fired because RUSTFLAGS: -D warnings upgraded pre-existing warnings to errors in code that the author never compiled with -D warnings.

The third CI step ('Lint (clippy, deny warnings)') was never reached in the failed run, so it surfaced only when the build was fixed locally. Cleaning that up revealed the same class of issues across multiple crates — all stemming from the same M2-M6 commit.

This commit makes every CI step green:

Build / test fixes (the 3 errors the user originally hit):

  • crates/idgen/src/lib.rs — drop 'mut' on 2 test variables
  • sdk-rust/examples/batch.rs — drop unused ProbeInput, ProbeMode

Clippy -D warnings fixes (8 additional lints):

  • crates/matchr/src/lib.rs — &[q.clone()] → slice::from_ref
  • crates/probe/src/nmap_probes.rs — drop redundant 'as u16'
  • crates/ouidb/src/lib.rs — drop redundant .into() on u8
  • crates/datastore/src/lib.rs — len() > 0 → !is_empty()
  • crates/branddb/src/lib.rs — to_ascii_lowercase() == → eq_ignore_ascii_case()
  • crates/ffi-c/src/brand.rs — drop 2 redundant .into() to String;
    allow field_reassign_with_default on the
    function (the conditional branch logic
    makes struct-literal init awkward)
  • crates/ffi-c/src/scan.rs — for i in 0..n → iter().take(n).enumerate()
  • crates/ffi-c/src/types.rs — add # Safety section to read_c_str

Branddb OUI hex literal lints (preserved values, not blindly accepted):

  • crates/branddb/src/builtin.rs — #[allow(mistyped_literal_suffixes)]
    on the RULES static + #[rustfmt::skip]
    to prevent re-bloat of the 5000-rule
    data table
  • crates/branddb/src/yaml.rs — #[allow(unusual_byte_groupings)]
    on the oui_yaml_roundtrip test

The OUI lints are tricky: clippy thinks 0xC4_65_16 should be 0xC465_u16 (and similar), but accepting that suggestion would change the value (24-bit OUI prefix becoming a 16-bit one) and break vendor matching. Comments at the allow sites explain why.

Format check (cargo fmt --check):

  • workspace-wide rustfmt sweep; most of the diff in crates/branddb/src/yaml.rs is a one-time alignment cleanup of the same OUI test fixtures.

Verified locally on windows-2022:

  • RUSTFLAGS=-D warnings cargo test --workspace → 256 passed, 0 failed
  • cargo clippy --workspace --all-targets -- -D warnings → clean
  • cargo fmt --all -- --check → clean

CI was failing on commit 0ea6200 (M2-M6) with build errors on all three
platforms. Two of the steps ('Build workspace' and 'Run unit tests')
fired because `RUSTFLAGS: -D warnings` upgraded pre-existing warnings
to errors in code that the author never compiled with -D warnings.

The third CI step ('Lint (clippy, deny warnings)') was never reached
in the failed run, so it surfaced only when the build was fixed
locally. Cleaning that up revealed the same class of issues across
multiple crates — all stemming from the same M2-M6 commit.

This commit makes every CI step green:

Build / test fixes (the 3 errors the user originally hit):
  - crates/idgen/src/lib.rs      — drop 'mut' on 2 test variables
  - sdk-rust/examples/batch.rs  — drop unused ProbeInput, ProbeMode

Clippy -D warnings fixes (8 additional lints):
  - crates/matchr/src/lib.rs            — &[q.clone()] → slice::from_ref
  - crates/probe/src/nmap_probes.rs     — drop redundant 'as u16'
  - crates/ouidb/src/lib.rs             — drop redundant .into() on u8
  - crates/datastore/src/lib.rs         — len() > 0 → !is_empty()
  - crates/branddb/src/lib.rs           — to_ascii_lowercase() == → eq_ignore_ascii_case()
  - crates/ffi-c/src/brand.rs           — drop 2 redundant .into() to String;
                                         allow field_reassign_with_default on the
                                         function (the conditional branch logic
                                         makes struct-literal init awkward)
  - crates/ffi-c/src/scan.rs            — for i in 0..n → iter().take(n).enumerate()
  - crates/ffi-c/src/types.rs           — add # Safety section to read_c_str

Branddb OUI hex literal lints (preserved values, not blindly accepted):
  - crates/branddb/src/builtin.rs       — #[allow(mistyped_literal_suffixes)]
                                         on the RULES static + #[rustfmt::skip]
                                         to prevent re-bloat of the 5000-rule
                                         data table
  - crates/branddb/src/yaml.rs          — #[allow(unusual_byte_groupings)]
                                         on the oui_yaml_roundtrip test

The OUI lints are tricky: clippy thinks 0xC4_65_16 should be
0xC465_u16 (and similar), but accepting that suggestion would
change the value (24-bit OUI prefix becoming a 16-bit one) and
break vendor matching. Comments at the allow sites explain why.

Format check (cargo fmt --check):
  - workspace-wide rustfmt sweep; most of the diff in
    crates/branddb/src/yaml.rs is a one-time alignment cleanup of
    the same OUI test fixtures.

Verified locally on windows-2022:
  - RUSTFLAGS=-D warnings cargo test --workspace  → 256 passed, 0 failed
  - cargo clippy --workspace --all-targets -- -D warnings  → clean
  - cargo fmt --all -- --check  → clean

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Laffinty Laffinty merged commit c54f253 into main Jun 6, 2026
0 of 3 checks passed
@Laffinty Laffinty deleted the fix/ci-lint-cleanup branch June 6, 2026 00:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant