Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use copy_from_slice() over clone_from_slice() for u8 slice copies #33536

Merged
merged 1 commit into from
Oct 5, 2023

Commits on Oct 5, 2023

  1. Use copy_from_slice() over clone_from_slice() for u8 slice copies

    clone_from_slice() would hypothetically visit each item in the slice and
    clone it whereas copy_from_slice() can memcpy the whole slice in one go.
    
    Technically, Rust does the right thing for us by making
    clone_from_slice() defer to copy_from_slice() for types that implement
    Copy trait. However, we should still use the more efficient method
    directly to show intent.
    steviez committed Oct 5, 2023
    Configuration menu
    Copy the full SHA
    d3acfeb View commit details
    Browse the repository at this point in the history