Improve documentation for slice swap/copy/clone operations.#46219
Merged
Improve documentation for slice swap/copy/clone operations.#46219
Conversation
Contributor
|
r? @BurntSushi (rust_highfive has picked a reviewer for you, use r? to override) |
bluss
reviewed
Nov 23, 2017
src/liballoc/slice.rs
Outdated
| /// | ||
| /// { | ||
| /// let (left, right) = slice.split_at_mut(2); | ||
| /// left[..2].swap_with_slice(&mut right[1..]); |
Contributor
There was a problem hiding this comment.
the [..2] here is now redundant, I think it's best to remove it.
bluss
reviewed
Nov 23, 2017
src/liballoc/slice.rs
Outdated
| /// | ||
| /// { | ||
| /// let (left, right) = slice.split_at_mut(2); | ||
| /// left[..2].copy_from_slice(&right[1..]); |
Collaborator
|
☔ 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
Contributor
Author
|
@bluss comments addressed in the latest force push |
Contributor
Author
|
r? @rust-lang/docs |
Member
|
Thanks! @bors: r+ rollup |
Collaborator
|
📌 Commit 1ad38f2 has been approved by |
Collaborator
|
⌛ Testing commit 1ad38f2 with merge b17670b20f9caaf6ff18badc020d0275015e4503... |
Collaborator
|
💔 Test failed - status-travis |
Member
|
@bors retry — travis-ci/travis-ci#8821 |
kennytm
added a commit
to kennytm/rust
that referenced
this pull request
Nov 29, 2017
…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`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #45636.
lengths
split_at_mut