Skip to content

Add doc comment to Vec::clone#157138

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
Omnikar:vec-clone-doc
Jun 4, 2026
Merged

Add doc comment to Vec::clone#157138
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
Omnikar:vec-clone-doc

Conversation

@Omnikar

@Omnikar Omnikar commented May 30, 2026

Copy link
Copy Markdown
Contributor

I read about Clippy's repeat_vec_with_capacity lint and figured it was worth adding a note about the relevant behavior to the documentation of Vec::clone itself, which previously did not have its own doc comment.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels May 30, 2026
@rustbot

rustbot commented May 30, 2026

Copy link
Copy Markdown
Collaborator

r? @joboet

rustbot has assigned @joboet.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: libs
  • libs expanded to 7 candidates
  • Random selection from Mark-Simulacrum, joboet

@joboet joboet left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good idea! The comment should however be a bit more vague about the actual capacity – we don't want to accidentally guarantee something we'd want to change later. How about saying that the capacity of the clone might not match the capacity of the original?

View changes since this review

@joboet

joboet commented May 30, 2026

Copy link
Copy Markdown
Member

@rustbot author

@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 30, 2026
@rustbot

rustbot commented May 30, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@rustbot rustbot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label May 30, 2026
@Omnikar

Omnikar commented May 30, 2026

Copy link
Copy Markdown
Contributor Author

Makes sense. @rustbot ready

@rustbot rustbot 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 May 30, 2026
@rust-log-analyzer

This comment has been minimized.

@Omnikar

Omnikar commented May 30, 2026

Copy link
Copy Markdown
Contributor Author

Not sure what happened with the CI run

@jhpratt

jhpratt commented May 30, 2026

Copy link
Copy Markdown
Member

@bors try jobs=x86_64-gnu-tools

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request May 30, 2026
Add doc comment to `Vec::clone`


try-job: x86_64-gnu-tools
@rust-bors

rust-bors Bot commented May 30, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 225e133 (225e13323067c661fa600699ed280e25d0213231, parent: c58275e0369d09fc3959b8ba87dcbcbe73797465)

@asder8215

Copy link
Copy Markdown
Contributor

The doc comment looks good to me. joboet might say this soon, but make sure to squash your commits to one.

@Omnikar

Omnikar commented May 31, 2026

Copy link
Copy Markdown
Contributor Author

The doc comment looks good to me. joboet might say this soon, but make sure to squash your commits to one.

I have to squash manually? It doesn't happen with the PR merge?

@asder8215

asder8215 commented May 31, 2026

Copy link
Copy Markdown
Contributor

I have to squash manually?

Yep. I think you could also do this through bors as well (though I've always squashed manually in my editor, so never tried it).

It doesn't happen with the PR merge?

I believe the rustbot (or whoever has permissions to merge it into the main branch) do merge PRs, but I think the point of this is to simplify commit history. If I were to put my cursor on line 3813 in my code editor, it'll tell me that it belongs to commit 6803293; however, if I put it over the line 3817, it'll tell me that it belongs to commit cd22dda. It's just neater to see 4 commits you made as 1 within commit history and overall squashing makes it easier for people to find what was changed in that portion of code (e.g. in case we need to revert something in the future).

You can check out this git section of rust compiler dev guide here for their git policy and tips.

@Omnikar

Omnikar commented May 31, 2026

Copy link
Copy Markdown
Contributor Author

@bors squash msg="Add doc comment to Vec::clone"

@rust-bors

This comment has been minimized.

@rust-bors

rust-bors Bot commented May 31, 2026

Copy link
Copy Markdown
Contributor

🔨 4 commits were squashed into c812d6d.

@rust-bors rust-bors Bot force-pushed the vec-clone-doc branch from cd22dda to c812d6d Compare May 31, 2026 18:15
@Omnikar

Omnikar commented Jun 4, 2026

Copy link
Copy Markdown
Contributor Author

@joboet What's the verdict?

@joboet

joboet commented Jun 4, 2026

Copy link
Copy Markdown
Member

Seems fine to me. I would have worded this a bit differently, but it gets the point across.

@bors r+ rollup

@rust-bors

rust-bors Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

📌 Commit aa9e76e has been approved by joboet

It is now in the queue for this repository.

@rust-bors rust-bors Bot 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 Jun 4, 2026
rust-bors Bot pushed a commit that referenced this pull request Jun 4, 2026
…uwer

Rollup of 4 pull requests

Successful merges:

 - #157297 (Add more tests for the `optimize` attribute)
 - #157377 (Add target checking to `#[register_tool]`)
 - #157138 (Add doc comment to `Vec::clone`)
 - #157400 (Add regression test for late-bound type param in nested `impl Trait`)
@rust-bors rust-bors Bot merged commit 649f157 into rust-lang:main Jun 4, 2026
12 checks passed
@rustbot rustbot added this to the 1.98.0 milestone Jun 4, 2026
rust-timer added a commit that referenced this pull request Jun 4, 2026
Rollup merge of #157138 - Omnikar:vec-clone-doc, r=joboet

Add doc comment to `Vec::clone`

I read about Clippy's [`repeat_vec_with_capacity`](https://rust-lang.github.io/rust-clippy/rust-1.96.0/index.html#repeat_vec_with_capacity) lint and figured it was worth adding a note about the relevant behavior to the documentation of `Vec::clone` itself, which previously did not have its own doc comment.
@Omnikar Omnikar deleted the vec-clone-doc branch June 9, 2026 04:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant 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.

6 participants