Skip to content

chore(rust-plugins): zero-warning codebase — fmt + clippy -D warnings, CI gate - #6415

Closed
julienmathis wants to merge 1 commit into
developfrom
chore/rust-lints
Closed

julienmathis wants to merge 1 commit into
developfrom
chore/rust-lints

Conversation

@julienmathis

Copy link
Copy Markdown
Contributor

Summary

Fixes every cargo clippy --all-targets warning in rust-plugins (unneeded returns, manual Option::map, needless borrows, &Vec/&Vec<T> instead of slices, legacy std::f64::INFINITY, collapsible ifs, unused lifetimes, useless .into() conversions, dead/unused imports, from_over_into on Status) and applies cargo fmt, without changing any runtime behavior.

Notable non-mechanical fixes:

  • output::OutputFormatter's inherent to_string() (shadowing the ToString trait) becomes a proper impl Display; call sites are unaffected since ToString is blanket-implemented for Display.
  • Three test modules (compute/mod.rs, compute/lexer.rs, compute/threshold.rs) lack #[cfg(test)] (see chore(rust-plugins): gate test modules behind #[cfg(test)] #6410): their imports/helpers are only used by #[test] fn bodies, which a plain (non-test) build strips, so clippy's default pass always flags them as unused regardless of gating elsewhere. Silenced locally with #[allow(unused_imports, dead_code)] rather than duplicating the #[cfg(test)] fix here, to avoid the two PRs conflicting on the same line — once chore(rust-plugins): gate test modules behind #[cfg(test)] #6410 merges these allows become redundant but harmless (also safe to drop them then).
  • snmp::mod.rs: a few imports (FailedToConnectToHost, InvalidSnmpPduDecode/Encode, log::info/trace, UdpSocket) are used only by the #[cfg(not(test))] variant of get_data_from_udp; moved local to that function instead of importing them crate-wide.

Adds a lint CI job (cargo fmt --check + cargo clippy --all-targets --release -- -D warnings) alongside the existing build/test job, so regressions are caught going forward.

Test plan

  • cargo fmt --check: clean
  • cargo clippy --all-targets --release -- -D warnings: clean
  • cargo build --release: succeeds
  • cargo test: 67 passed, 0 failed

Nivoky
Nivoky previously approved these changes Oct 1, 2026
pkriko
pkriko previously approved these changes Oct 26, 2026
…, CI gate

Fixes every cargo clippy --all-targets warning in rust-plugins (unneeded
returns, manual Option::map, needless borrows, &Vec/&Vec<T> instead of
slices, legacy std::f64::INFINITY, collapsible ifs, unused lifetimes,
useless .into() conversions, dead/unused imports, from_over_into on
Status) and applies cargo fmt, without changing any runtime behavior.

Notable non-mechanical fixes:
- output::OutputFormatter's inherent to_string() (shadowing the
  ToString trait) becomes a proper impl Display; call sites are
  unaffected since ToString is blanket-implemented for Display.
- Three test modules (compute/mod.rs, compute/lexer.rs,
  compute/threshold.rs) lack #[cfg(test)] (see the dedicated PR for
  that): their imports/helpers are only used by #[test] fn bodies,
  which a plain (non-test) build strips, so clippy's default pass always
  flags them as unused regardless of gating elsewhere. Silenced locally
  with #[allow(unused_imports, dead_code)] rather than duplicating the
  #[cfg(test)] fix here, to avoid the two PRs conflicting on the same line.
- snmp::mod.rs: a few imports (FailedToConnectToHost,
  InvalidSnmpPduDecode/Encode, log::info/trace, UdpSocket) are used only
  by the #[cfg(not(test))] variant of get_data_from_udp; moved local to
  that function instead of importing them crate-wide.

Adds a "lint" CI job (cargo fmt --check + cargo clippy --all-targets
--release -- -D warnings) alongside the existing build/test job, so
regressions are caught going forward.

Test plan:
- cargo fmt --check: clean
- cargo clippy --all-targets --release -- -D warnings: clean
- cargo build --release: succeeds
- cargo test: 67 passed, 0 failed
@github-actions

Copy link
Copy Markdown

❌ Jira reference required

No Jira issue key (for example MON-12345) was found in the branch name chore/rust-lints nor in the pull request description.

Every pull request targeting develop, dev-*, release-* or hotfix-* must be traceable to a Jira issue. To fix it:

  • add the key of the Jira issue to the pull request description (for example Refs: MON-12345 or a link to the issue),
  • then re-run all jobs of workflow check-status.

Prefix the branch name with the key for the next pull requests (for example MON-12345-short-description).
If this pull request legitimately has no Jira issue, add label skip-jira-reference and re-run all jobs of workflow check-status.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants