Add clarity to the examples of some Vec & VecDeque methods#134310
Merged
bors merged 3 commits intorust-lang:masterfrom Dec 15, 2024
Merged
Add clarity to the examples of some Vec & VecDeque methods#134310bors merged 3 commits intorust-lang:masterfrom
Vec & VecDeque methods#134310bors merged 3 commits intorust-lang:masterfrom
Conversation
Collaborator
|
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Noratrieb (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
This comment has been minimized.
This comment has been minimized.
In some `Vec` and `VecDeque` examples where elements are i32, examples can seem a bit confusing at first glance if a parameter of the method is an usize.
Contributor
Author
|
@rustbot label +A-docs |
Noratrieb
approved these changes
Dec 14, 2024
Member
Noratrieb
left a comment
There was a problem hiding this comment.
Thanks, I agree that this makes it a lot clearer!
Member
|
@bors r+ rollup |
Collaborator
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Dec 15, 2024
Rollup of 7 pull requests Successful merges: - rust-lang#130361 (std::net: Solaris supports `SOCK_CLOEXEC` as well since 11.4.) - rust-lang#133406 (Add value accessor methods to `Mutex` and `RwLock`) - rust-lang#133633 (don't show the full linker args unless `--verbose` is passed) - rust-lang#134285 (Add some convenience helper methods on `hir::Safety`) - rust-lang#134310 (Add clarity to the examples of some `Vec` & `VecDeque` methods) - rust-lang#134313 (Don't make a def id for `impl_trait_in_bindings`) - rust-lang#134315 (A couple of polonius fact generation cleanups) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Dec 15, 2024
Rollup merge of rust-lang#134310 - tkr-sh:master, r=Noratrieb Add clarity to the examples of some `Vec` & `VecDeque` methods In some `Vec` and `VecDeque` examples where elements are `i32`, examples can seem a bit confusing at first glance if a parameter of the method is an `usize`. In this case, I think it's better to use `char` rather than `i32`. > [!NOTE] > It's already done in the implementation of `VecDeque::insert` #### Difference - `i32` ```rs let mut v = vec![1, 2, 3]; assert_eq!(v.remove(1), 2); assert_eq!(v, [1, 3]); ``` - `char` ```rs let mut v = vec!['a', 'b', 'c']; assert_eq!(v.remove(1), 'b'); assert_eq!(v, ['a', 'c']); ``` Even tho it's pretty minor, it's a nice to have.
tautschnig
added a commit
to tautschnig/verify-rust-std
that referenced
this pull request
Jan 17, 2025
In some
VecandVecDequeexamples where elements arei32, examples can seem a bit confusing at first glance if a parameter of the method is anusize.In this case, I think it's better to use
charrather thani32.Note
It's already done in the implementation of
VecDeque::insertDifference
i32charEven tho it's pretty minor, it's a nice to have.