Skip to content

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

Merged
merged 1 commit into from
Nov 29, 2017

Conversation

frewsxcv
Copy link
Member

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

@rust-highfive
Copy link
Contributor

r? @BurntSushi

(rust_highfive has picked a reviewer for you, use r? to override)

///
/// {
/// let (left, right) = slice.split_at_mut(2);
/// left[..2].swap_with_slice(&mut right[1..]);
Copy link
Member

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.

///
/// {
/// let (left, right) = slice.split_at_mut(2);
/// left[..2].copy_from_slice(&right[1..]);
Copy link
Member

Choose a reason for hiding this comment

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

Same here.

@bors
Copy link
Collaborator

bors commented Nov 24, 2017

☔ The latest upstream changes (presumably #46225) made this pull request unmergeable. Please resolve the merge conflicts.

@kennytm kennytm added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Nov 24, 2017
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`
@frewsxcv frewsxcv force-pushed the frewsxcv-issue-45636 branch from f58e5e5 to 1ad38f2 Compare November 24, 2017 15:09
@frewsxcv
Copy link
Member Author

@bluss comments addressed in the latest force push

@kennytm kennytm added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 24, 2017
@frewsxcv
Copy link
Member Author

r? @rust-lang/docs

@GuillaumeGomez
Copy link
Member

Thanks!

@bors: r+ rollup

@bors
Copy link
Collaborator

bors commented Nov 28, 2017

📌 Commit 1ad38f2 has been approved by GuillaumeGomez

@kennytm kennytm added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 28, 2017
@bors
Copy link
Collaborator

bors commented Nov 29, 2017

⌛ Testing commit 1ad38f2 with merge b17670b20f9caaf6ff18badc020d0275015e4503...

@bors
Copy link
Collaborator

bors commented Nov 29, 2017

💔 Test failed - status-travis

@kennytm
Copy link
Member

kennytm commented Nov 29, 2017

@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`
bors added a commit that referenced this pull request Nov 29, 2017
Rollup of 10 pull requests

- Successful merges: #45969, #46077, #46219, #46287, #46293, #46322, #46323, #46330, #46354, #46356
- Failed merges:
@bors bors merged commit 1ad38f2 into master Nov 29, 2017
@GuillaumeGomez GuillaumeGomez deleted the frewsxcv-issue-45636 branch November 29, 2017 15:23
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants