-
Notifications
You must be signed in to change notification settings - Fork 13.4k
std: fix doctest and explain for as_slices
and as_mut_slices
in VecDeque
#141230
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
Conversation
https://doc.rust-lang.org/std/collections/struct.VecDeque.html#method.as_mut_slices as_mut_slices have the same issue, should it be fixed, too? It's more complicates there because example directly changes slices… which can lead to different outcome or even crash, if internal algorithm of |
In the changes, I also fixed the doc of as_mut_slice,but I typo in the pr title. lol |
as_slice
and as_slice_mut
in VecDeque
as_slices
and as_mut_slices
in VecDeque
Lone time no see. Thanks for your suggestion, I modified the code as you suggested. I have a little concern that |
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.
Thanks for the updates, the changes lgtm.
I have a little concern that closure in the example of as_mut_slices will be difficult to understand for new comers (I'm not sure if the closure is a required knowledge for new comers).
I think they are usually introduced pretty early, but it doesn't have to be a closure. If you prefer, it can be a fn updat_nth(deque: &mut VecDeque<u32>, index: usize, val: u32)
.
Please squash then r=me with or without changing to a function.
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
There doesn't seem to be anything wrong with using the base closure. :) @bors r=tgross35 |
@xizheyin: 🔑 Insufficient privileges: Not in reviewers |
Oh, I does not have permission to merge it. @tgross35 |
Thanks! @bors r+ rollup |
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#140526 (docs: Specify that common sort functions sort in an ascending direction) - rust-lang#141230 (std: fix doctest and explain for `as_slices` and `as_mut_slices` in `VecDeque`) - rust-lang#141341 (limit impls of `VaArgSafe` to just types that are actually safe) - rust-lang#141347 (incorrectly prefer builtin `dyn` impls :3) - rust-lang#141351 (Move -Zcrate-attr injection to just after crate root parsing) - rust-lang#141356 (lower bodies' params to thir before the body's value) - rust-lang#141357 (`unpretty=thir-tree`: don't require the final expr to be the body's value) - rust-lang#141363 (Document why we allow escaping bound vars in LTA norm) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#141230 - xizheyin:issue-141217, r=tgross35 std: fix doctest and explain for `as_slices` and `as_mut_slices` in `VecDeque` Fixes rust-lang#141217 r? libs
Fixes #141217
r? libs