Skip to content

lint: enable redundant_clone, cloned_instead_of_copied, needless_pass_by_ref_mut#781

Closed
strawgate wants to merge 2 commits into
masterfrom
lint-enable-performance-clippy-3875422540943888202
Closed

lint: enable redundant_clone, cloned_instead_of_copied, needless_pass_by_ref_mut#781
strawgate wants to merge 2 commits into
masterfrom
lint-enable-performance-clippy-3875422540943888202

Conversation

@strawgate
Copy link
Copy Markdown
Owner

Enabled three performance and correctness lints (redundant_clone, cloned_instead_of_copied, needless_pass_by_ref_mut) in [workspace.lints.clippy] of the root Cargo.toml.

Executed cargo clippy --fix to address the initial violations and other minor warnings across the workspace, ensuring a clean linting state. Verified that all lints pass and that existing tests continue to pass.

Fixes #764


PR created automatically by Jules for task 3875422540943888202 started by @strawgate

@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 3, 2026

Caution

Review failed

Pull request was closed or merged during review

Walkthrough

This PR makes multiple coordinated changes: it enables three workspace Clippy lints in Cargo.toml; redesigns conflict-field handling by replacing StructArray conflict columns with double-underscore suffixed flat columns and recording conflict groups in schema metadata (logfwd.conflict_groups); propagates that redesign through streaming/storage builders, transform normalization, sinks, UDFs, and tests; simplifies passthrough/format/framed input behavior and removes EOF events; changes diagnostics server start() return type; updates Kani verification guidance and many docs and tests to match the new shapes and ownership conventions.

Possibly related PRs


Caution

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

  • Ignore

❌ Failed checks (1 error, 3 warnings)

Check name Status Explanation Resolution
Formal Verification Coverage ❌ Error PR removes #[kani::unwind(N)] annotations from five proof functions in structural.rs without justification, violating the requirement that every loop must carry unwind bounds to prevent unsound verification. Restore all removed #[kani::unwind] annotations (verify_prefix_xor, verify_process_block_no_panic, verify_process_block_tail_mask, verify_in_string_exclusion, verify_next_quote_correct) and verify loop soundness.
Out of Scope Changes check ⚠️ Warning Extensive out-of-scope refactoring detected: conflict-column representation rewrite (StructArray→suffixed columns), conflict metadata schema changes, config deserialization changes, output sink refactoring, and comprehensive test/doc updates unrelated to the stated lint-enabling objective. Isolate lint changes into a separate minimal PR; move conflict-column redesign, output refactoring, and documentation updates to dedicated pull requests aligned with their specific objectives.
Documentation Thoroughly Updated ⚠️ Warning Documentation gaps prevent passing: CRATE_RULES.md missing Kani exemption categories, PHASES.md Phase 10a tasks remain TODO, SCANNER_CONTRACT.md uses outdated single-underscore format, DEVELOPING.md lacks metadata encoding lessons, ARCHITECTURE.md unclear on pipeline changes. Update CRATE_RULES.md with three Kani exemptions; mark Phase 10a DONE in PHASES.md; fix SCANNER_CONTRACT.md to double-underscore format; add metadata encoding lesson to DEVELOPING.md; clarify ARCHITECTURE.md pipeline changes.
Maintainer Fitness ⚠️ Warning PR claims trivial lint-enable but conceals comprehensive 20+ file architecture refactor with undocumented scope creep and unresolved design flaws. Revert and split: (1) minimal Cargo.toml lint-enable with issue #764 fix; (2) separate architectural PR with JSON-safe metadata encoding, completed abstractions, resolved review issues, and benchmarks.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed PR comprehensively addresses all requirements from issue #764: enables three Clippy lints (redundant_clone, cloned_instead_of_copied, needless_pass_by_ref_mut) in workspace config, fixes the single pre-existing redundant_clone violation, and confirms clippy --fix passes.
High-Quality Rust Practices ✅ Passed PR correctly implements six high-quality Rust practices: public constant properly documented, production code uses appropriate error handling, unsafe blocks have SAFETY comments, no problematic clones in hot paths.
Crate Boundary And Dependency Integrity ✅ Passed PR enables three Clippy lints and fixes violations through refactoring. No new crates, no external dependencies, core maintains strict boundaries with only memchr and wide as production dependencies, #![forbid(unsafe_code)] enforced, zero std imports, and crate-boundary constraints satisfied.
✨ Finishing Touches
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch lint-enable-performance-clippy-3875422540943888202

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

…_by_ref_mut

Enabled three performance and correctness lints in the workspace.
Fixed existing violations and other minor clippy warnings.

Co-authored-by: strawgate <6384545+strawgate@users.noreply.github.com>
@strawgate strawgate force-pushed the lint-enable-performance-clippy-3875422540943888202 branch from e121515 to c44e2a8 Compare April 3, 2026 03:32
@strawgate
Copy link
Copy Markdown
Owner Author

Rebased on master, resolved conflict in conflict_schema.rs (took master's fuller assertions, removed redundant .clone()). All tests pass, clippy clean.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
crates/logfwd/tests/compliance_file.rs (1)

334-342: 🧹 Nitpick | 🔵 Trivial

Rename log_path_clone to match the new ownership.

This value is moved into the writer thread now, not cloned, so the current name is misleading.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/logfwd/tests/compliance_file.rs` around lines 334 - 342, The variable
name log_path_clone is misleading because its ownership is moved into the writer
thread; rename the binding (where let log_path_clone = log_path;) to something
that reflects transfer of ownership (e.g., log_path_owned or log_path_moved) and
update any references inside the spawned thread (the closure passed to
std::thread::spawn that uses log_path_clone and opens the file) to use the new
name; ensure the new binding still takes ownership (no clone()) so the move
semantics and writer_handle usage remain unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@crates/logfwd-core/tests/compliance_data.rs`:
- Around line 646-649: The code unnecessarily allocates a String with
key.to_string() before calling get_str; replace that allocation by using the
borrowed key directly (from the closure's key binding) when calling
assert_both_scanners and get_str. Locate the closure passed to
assert_both_scanners and change the usage of the variable produced by
key.to_string() so you pass the borrowed &str (the existing key) directly to
get_str (and remove let col_name = key.to_string()), referencing
assert_both_scanners and get_str to find where to update.

---

Outside diff comments:
In `@crates/logfwd/tests/compliance_file.rs`:
- Around line 334-342: The variable name log_path_clone is misleading because
its ownership is moved into the writer thread; rename the binding (where let
log_path_clone = log_path;) to something that reflects transfer of ownership
(e.g., log_path_owned or log_path_moved) and update any references inside the
spawned thread (the closure passed to std::thread::spawn that uses
log_path_clone and opens the file) to use the new name; ensure the new binding
still takes ownership (no clone()) so the move semantics and writer_handle usage
remain unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro

Run ID: 7053b22b-98c2-41a2-bd3e-497e50dc4b22

📥 Commits

Reviewing files that changed from the base of the PR and between 41f1ae3 and c44e2a8.

📒 Files selected for processing (28)
  • Cargo.toml
  • crates/logfwd-arrow/src/streaming_builder.rs
  • crates/logfwd-arrow/tests/allocation_regression.rs
  • crates/logfwd-bench/benches/elasticsearch_arrow.rs
  • crates/logfwd-bench/benches/pipeline.rs
  • crates/logfwd-config/src/lib.rs
  • crates/logfwd-core/benches/scanner.rs
  • crates/logfwd-core/examples/arrow_ipc_roundtrip.rs
  • crates/logfwd-core/src/pipeline/lifecycle.rs
  • crates/logfwd-core/tests/compliance_data.rs
  • crates/logfwd-core/tests/scanner_conformance.rs
  • crates/logfwd-io/src/generator.rs
  • crates/logfwd-io/src/metric_history.rs
  • crates/logfwd-io/src/otlp_receiver.rs
  • crates/logfwd-io/tests/transport_e2e.rs
  • crates/logfwd-output/src/lib.rs
  • crates/logfwd-output/src/loki.rs
  • crates/logfwd-output/tests/elasticsearch_arrow_ipc.rs
  • crates/logfwd-test-utils/src/sinks.rs
  • crates/logfwd-transform/src/conflict_schema.rs
  • crates/logfwd-transform/src/lib.rs
  • crates/logfwd/src/pipeline.rs
  • crates/logfwd/src/worker_pool.rs
  • crates/logfwd/tests/allocation_e2e.rs
  • crates/logfwd/tests/allocation_scaling.rs
  • crates/logfwd/tests/compliance.rs
  • crates/logfwd/tests/compliance_file.rs
  • crates/logfwd/tests/integration.rs

Comment thread crates/logfwd-core/tests/compliance_data.rs
@google-labs-jules
Copy link
Copy Markdown
Contributor

Rebased on master, resolved conflict in conflict_schema.rs (took master's fuller assertions, removed redundant .clone()). All tests pass, clippy clean.

Acknowledged. I have enabled the requested performance lints and verified that the workspace is now clippy clean, including the fixes in conflict_schema.rs.

Co-authored-by: strawgate <6384545+strawgate@users.noreply.github.com>
@strawgate
Copy link
Copy Markdown
Owner Author

Closing: master has diverged significantly (44 files changed). The lint changes (redundant_clone, cloned_instead_of_copied, needless_pass_by_ref_mut) can be re-applied fresh on current master with cargo clippy --fix. Will re-create if needed.

@strawgate strawgate closed this Apr 3, 2026
@google-labs-jules
Copy link
Copy Markdown
Contributor

Closing: master has diverged significantly (44 files changed). The lint changes (redundant_clone, cloned_instead_of_copied, needless_pass_by_ref_mut) can be re-applied fresh on current master with cargo clippy --fix. Will re-create if needed.

Understood. Acknowledging that this work is now obsolete due to master divergence and stopping work on this task.

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.

lint: enable redundant_clone, cloned_instead_of_copied, needless_pass_by_ref_mut

1 participant