-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Improve documentation for slice swap/copy/clone operations. #46219
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
r? @BurntSushi (rust_highfive has picked a reviewer for you, use r? to override) |
src/liballoc/slice.rs
Outdated
/// | ||
/// { | ||
/// let (left, right) = slice.split_at_mut(2); | ||
/// left[..2].swap_with_slice(&mut right[1..]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the [..2]
here is now redundant, I think it's best to remove it.
src/liballoc/slice.rs
Outdated
/// | ||
/// { | ||
/// let (left, right) = slice.split_at_mut(2); | ||
/// left[..2].copy_from_slice(&right[1..]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
☔ The latest upstream changes (presumably #46225) made this pull request unmergeable. Please resolve the merge conflicts. |
Fixes #45636. - Demonstrate how to use these operations with slices of differing lengths - Demonstrate how to swap/copy/clone sub-slices of a slice using `split_at_mut`
f58e5e5
to
1ad38f2
Compare
@bluss comments addressed in the latest force push |
r? @rust-lang/docs |
Thanks! @bors: r+ rollup |
📌 Commit 1ad38f2 has been approved by |
⌛ Testing commit 1ad38f2 with merge b17670b20f9caaf6ff18badc020d0275015e4503... |
💔 Test failed - status-travis |
@bors retry — travis-ci/travis-ci#8821 |
…uillaumeGomez Improve documentation for slice swap/copy/clone operations. Fixes rust-lang#45636. - Demonstrate how to use these operations with slices of differing lengths - Demonstrate how to swap/copy/clone sub-slices of a slice using `split_at_mut`
Fixes #45636.
lengths
split_at_mut