Skip to content

Update example code for Vec::splice to change the length - #92071

Merged
bors merged 1 commit into
rust-lang:masterfrom
ajtribick:patch-1
Dec 19, 2021
Merged

Update example code for Vec::splice to change the length#92071
bors merged 1 commit into
rust-lang:masterfrom
ajtribick:patch-1

Conversation

@ajtribick

Copy link
Copy Markdown
Contributor

The current example for Vec::splice illustrates the replacement of a section of length 2 with a new section of length 2. This isn't a particularly interesting case for splice, and makes it look a bit like a shorthand for the kind of manipulations that could be done with a mutable slice.

In order to provide a stronger example, this updates the example to use different lengths for the source and destination regions, and uses a slice from the middle of the vector to illustrate that this does not necessarily have to be at the beginning or the end.

Resolves#92067

@rust-highfive

Copy link
Copy Markdown
Contributor

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @dtolnay (or someone else) soon.

Please see the contribution instructions for more information.

@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 18, 2021
@jyn514jyn514 added A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Dec 18, 2021
@the8472

Copy link
Copy Markdown
Member

LGTM

@bors r+ rollup=always

@bors

bors commented Dec 18, 2021

Copy link
Copy Markdown
Collaborator

📌 Commit 574bc67 has been approved by the8472

@borsbors 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 Dec 18, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 19, 2021
…askrgr
Rollup of 7 pull requests
Successful merges:
- rust-lang#91141 (Revert "Temporarily rename int_roundings functions to avoid conflicts")
- rust-lang#91984 (Remove `in_band_lifetimes` from `rustc_middle`)
- rust-lang#92028 (Sync portable-simd to fix libcore build for AVX-512 enabled targets)
- rust-lang#92042 (Enable `#[thread_local]` for all windows-msvc targets)
- rust-lang#92071 (Update example code for Vec::splice to change the length)
- rust-lang#92077 (rustdoc: Remove unused `collapsed` field)
- rust-lang#92081 (rustdoc: Remove unnecessary `need_backline` function)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
@bors
bors merged commit 690d6b0 into rust-lang:masterDec 19, 2021
@rustbotrustbot added this to the 1.59.0 milestone Dec 19, 2021
@ajtribick
ajtribick deleted the patch-1 branch December 19, 2021 16:43
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsS-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-libsRelevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve the example for Vec::splice

7 participants

@ajtribick@rust-highfive@the8472@bors@dtolnay@jyn514@rustbot