Skip to content

Conversation

@qwandor
Copy link
Collaborator

@qwandor qwandor commented Jan 5, 2026

No description provided.

Copy link
Collaborator

@m4tx m4tx left a comment

Choose a reason for hiding this comment

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

What's the benefit of this? Usually the compiler is smart enough to figure out the type is big and it's cheaper to pass the reference rather than value. You can see in the code here that [u8; 1024] is actually passed by reference and it doesn't matter whether you manually pass reference, and there's no memcpy in the resulting assembly as long as you enable optimizations. Coincidentally, I even answered this very question (whether it makes a difference to pass Copy types by reference) a while ago on Stack Overflow: https://stackoverflow.com/a/79167130

If there's some additional value in this that I don't see right now, I think we should keep the missing_copy_implementations lint, as we already enable large_types_passed_by_value clippy lint anyway (note that it triggers for types larger than 256 bytes by default).

@qwandor
Copy link
Collaborator Author

qwandor commented Jan 8, 2026

Okay, dropping this.

@qwandor qwandor closed this Jan 8, 2026
@qwandor qwandor deleted the copy branch January 8, 2026 14:52
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