Skip to content

chore(vector-core): remove fanout pass-by-value lint allow - #26321

Merged
thomasqueirozb merged 1 commit into
vectordotdev:masterfrom
arfa79:chore/vector-core-fanout-pass-by-value
Sep 9, 2026
Merged

thomasqueirozb merged 1 commit into
vectordotdev:masterfrom
arfa79:chore/vector-core-fanout-pass-by-value

Conversation

@arfa79

@arfa79 arfa79 commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Removes the clippy::needless_pass_by_value suppression from SendGroup::add by borrowing the component key and cloning it only when inserting it into the sender map.

References

Related: #23659

Vector configuration

Not applicable; this is an internal refactor with no configuration changes.

How did you test this PR?

  • cargo test -p vector-core fanout --lib
  • cargo clippy -p vector-core --lib -- -D warnings
  • cargo fmt --all -- --check
  • git diff --check

Does this PR include user facing changes?

  • Yes. Please add a changelog fragment based on our guidelines.
  • No. A maintainer will apply the no-changelog label to this PR.

Contributor Guidelines

  • Please read our Vector contributor resources.
  • Do not hesitate to use @vectordotdev/vector to reach out to us regarding this PR.
  • Before pushing, follow our pre-push guidance.
  • After a review is requested, please avoid force pushes to help us review incrementally.
    • Feel free to push as many commits as you want. They will be squashed into one before merging.
    • For example, you can run git merge origin master and git push.

@arfa79
arfa79 requested a review from a team as a code owner September 8, 2026 08:15
Copilot AI lite review requested due to automatic review settings September 8, 2026 08:15
@github-actions github-actions Bot added the domain: core Anything related to core crates i.e. vector-core, core-common, etc label Sep 8, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The change is a small, low-risk internal refactor that preserves behavior while removing a Clippy suppression.

Pull request overview

This PR refactors vector-core’s fanout control-message handling to remove a clippy::needless_pass_by_value suppression in SendGroup::add, changing the method to borrow the component key and clone only when inserting into the sender map.

Changes:

  • Update SendGroup::add to take &ComponentKey and remove the clippy::needless_pass_by_value allow.
  • Adjust the in-flight control-message Add handling to pass &id into SendGroup::add.
File summaries
File Description
lib/vector-core/src/fanout.rs Removes a Clippy suppression by switching SendGroup::add to take a borrowed key and cloning for insertion into the sender map.
Review details

Suppressed comments (1)

lib/vector-core/src/fanout.rs:384

  • SendGroup::add now takes &ComponentKey and clones it to insert into self.senders. Since ControlMessage::Add already yields an owned ComponentKey, this introduces an avoidable allocation on every add (because ComponentKey clones its inner String). Consider switching SendGroup::add back to taking id: ComponentKey and moving it into the IndexMap (similar to Fanout::add), which removes the need for both the clone and the previous clippy suppression.
        // When we're in the middle of a send, we can only keep track of the new sink, but can't
        // actually send to it, as we don't have the item to send... so only add it to `senders`.
        assert!(
            self.senders
                .insert(id.clone(), Some(Sender::new(sink)))
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@thomasqueirozb thomasqueirozb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@thomasqueirozb thomasqueirozb added the no-changelog Changes in this PR do not need user-facing explanations in the release changelog label Sep 9, 2026
@thomasqueirozb
thomasqueirozb added this pull request to the merge queue Sep 9, 2026
Merged via the queue into vectordotdev:master with commit 5cfe2b2 Sep 9, 2026
82 of 83 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 9, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

domain: core Anything related to core crates i.e. vector-core, core-common, etc no-changelog Changes in this PR do not need user-facing explanations in the release changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants