Skip to content

chore: fix clippy lints for rust 1.97#1721

Merged
nikhilsinhaparseable merged 1 commit into
parseablehq:mainfrom
prabhaks:fix/clippy-rust-1.97
Jul 11, 2026
Merged

chore: fix clippy lints for rust 1.97#1721
nikhilsinhaparseable merged 1 commit into
parseablehq:mainfrom
prabhaks:fix/clippy-rust-1.97

Conversation

@prabhaks

@prabhaks prabhaks commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

What

Rust/clippy 1.97 (now on CI's stable toolchain) introduced new lints that fail the clippy check (cargo hack clippy --each-feature --no-dev-deps -- -D warnings) against existing code on main. This currently breaks the coverage job on every open PR, not just one. This PR fixes those lints so CI goes green again.

Lints fixed

  • for_kv_map: iterate map.values() instead of map.iter() when the key is unused (rbac/mod.rs, sse/mod.rs, alerts/target.rs, connectors/kafka/metrics.rs)
  • useless_borrows_in_formatting: drop the redundant & in format! arguments (storage/s3.rs, storage/gcs.rs, metastore/.../object_store_metastore.rs, handlers/airplane.rs, handlers/http/alerts.rs, handlers/http/cluster/mod.rs, metrics/prom_utils.rs, query/listing_table_builder.rs)
  • cloned_ref_to_slice_refs: use std::slice::from_ref(x) instead of &[x.to_string()] (users/filters.rs)
  • collapse a match on a Result into the ? operator (parseable/streams.rs)

These are mechanical, behavior-preserving fixes, mostly produced by cargo clippy --fix. No functional change.

Verification

Ran locally with clippy 1.97.0 (matching CI):

  • cargo clippy --no-deps -- -D warnings: clean
  • cargo clippy --no-default-features --no-deps -- -D warnings: clean

The kafka feature fix (connectors/kafka/metrics.rs) is the same for_kv_map pattern applied elsewhere; its native librdkafka build was not run locally, so CI's --each-feature kafka run will validate it.

Summary by CodeRabbit

  • Refactor
    • Simplified internal iteration and formatting logic across alert, metrics, storage, authentication, and request-handling workflows.
    • Streamlined schema error propagation during disk-file conversion.
    • Preserved existing alert deletion, broker metrics, authorization, broadcasting, URL generation, and request behavior.

Rust/clippy 1.97 introduced new lints that now fail the CI clippy check
(`cargo hack clippy --each-feature -- -D warnings`) against existing code:

- for_kv_map: iterate `map.values()` instead of `map.iter()` with an
  unused key
- useless_borrows_in_formatting: drop the redundant `&` in `format!`
  arguments
- cloned_ref_to_slice_refs: use `std::slice::from_ref(x)` instead of
  `&[x.to_string()]`
- collapse a `match` on a `Result` into the `?` operator

These are mechanical, behavior-preserving fixes (mostly via
`cargo clippy --fix`). No functional change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 6f447d48-265e-48cb-ad9d-1654837e385c

📥 Commits

Reviewing files that changed from the base of the PR and between 47cff47 and a003dd2.

📒 Files selected for processing (14)
  • src/alerts/target.rs
  • src/connectors/kafka/metrics.rs
  • src/handlers/airplane.rs
  • src/handlers/http/alerts.rs
  • src/handlers/http/cluster/mod.rs
  • src/metastore/metastores/object_store_metastore.rs
  • src/metrics/prom_utils.rs
  • src/parseable/streams.rs
  • src/query/listing_table_builder.rs
  • src/rbac/mod.rs
  • src/sse/mod.rs
  • src/storage/gcs.rs
  • src/storage/s3.rs
  • src/users/filters.rs

Walkthrough

The PR removes unnecessary borrows, unused map keys, and verbose error propagation across Rust modules. Existing iteration behavior, path construction, authorization, error handling, and storage URL generation remain unchanged.

Changes

Rust cleanup

Layer / File(s) Summary
Collection iteration cleanup
src/alerts/target.rs, src/connectors/kafka/metrics.rs, src/rbac/mod.rs, src/sse/mod.rs
Alert, broker, user, and session loops now iterate directly over values instead of unused key/value pairs.
Formatting and path construction cleanup
src/handlers/..., src/metastore/..., src/metrics/prom_utils.rs, src/query/listing_table_builder.rs, src/storage/...
Unnecessary references are removed from formatted SQL, URIs, object-store paths, metrics URLs, and storage URLs.
Error and authorization argument cleanup
src/parseable/streams.rs, src/users/filters.rs
Schema errors use ? propagation, and dataset authorization receives a borrowed one-item slice.

Estimated code review effort: 2 (Simple) | ~10 minutes

Poem

I nipped each needless borrow away,
And let value-only loops lead the day.
Paths still point, metrics still sing,
Errors still fly on the question-mark wing.
Hop, hop—clean Rust takes spring!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: fixing Clippy lint failures for Rust 1.97.
Description check ✅ Passed The description covers the goal, lint categories fixed, rationale, and verification, matching the template well.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nikhilsinhaparseable nikhilsinhaparseable merged commit d6a3b5a into parseablehq:main Jul 11, 2026
12 checks passed
@prabhaks prabhaks deleted the fix/clippy-rust-1.97 branch July 11, 2026 05:43
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.

2 participants