Skip to content

Add doc comment to Vec::clone#157138

Open
Omnikar wants to merge 1 commit into
rust-lang:mainfrom
Omnikar:vec-clone-doc
Open

Add doc comment to Vec::clone#157138
Omnikar wants to merge 1 commit into
rust-lang:mainfrom
Omnikar:vec-clone-doc

Conversation

@Omnikar
Copy link
Copy Markdown
Contributor

@Omnikar Omnikar commented May 30, 2026

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
Copy link
Copy Markdown
Collaborator

rustbot commented May 30, 2026

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

Copy link
Copy Markdown
Member

@joboet joboet left a comment

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
Copy link
Copy Markdown
Member

joboet commented May 30, 2026

@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
Copy link
Copy Markdown
Collaborator

rustbot commented May 30, 2026

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
Copy link
Copy Markdown
Contributor Author

Omnikar commented May 30, 2026

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
Copy link
Copy Markdown
Contributor Author

Omnikar commented May 30, 2026

Not sure what happened with the CI run

@jhpratt
Copy link
Copy Markdown
Member

jhpratt commented May 30, 2026

@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
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 30, 2026

☀️ 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
Copy link
Copy Markdown
Contributor Author

Omnikar commented May 31, 2026

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
Copy link
Copy Markdown
Contributor

asder8215 commented May 31, 2026

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
Copy link
Copy Markdown
Contributor Author

Omnikar commented May 31, 2026

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

@rust-bors

This comment has been minimized.

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 31, 2026

🔨 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants