Skip to content
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

new lint: repeat_vec_with_capacity #11597

Merged
merged 2 commits into from
Dec 1, 2023
Merged

Conversation

y21
Copy link
Member

@y21 y21 commented Oct 2, 2023

Closes #11537

Lint description should explain this PR :)

changelog: new lint: repeat_vec_with_capacity

@rustbot
Copy link
Collaborator

rustbot commented Oct 2, 2023

r? @dswij

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Oct 2, 2023
@bors
Copy link
Collaborator

bors commented Nov 14, 2023

☔ The latest upstream changes (presumably #11791) made this pull request unmergeable. Please resolve the merge conflicts.

@y21
Copy link
Member Author

y21 commented Nov 15, 2023

@dswij you wanted me to ping you :)

@bors
Copy link
Collaborator

bors commented Nov 19, 2023

☔ The latest upstream changes (presumably #11781) made this pull request unmergeable. Please resolve the merge conflicts.

Copy link
Member

@dswij dswij left a comment

Choose a reason for hiding this comment

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

Sorry for the late review.

Implementation looks great! Just some minor comments

/// ### What it does
/// Looks for patterns such as `vec![Vec::with_capacity(x); n]` or `iter::repeat(Vec::with_capacity(x))`.
///
/// ### Why is this bad?
Copy link
Member

Choose a reason for hiding this comment

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

Excellent explanation!

clippy_lints/src/repeat_vec_with_capacity.rs Show resolved Hide resolved
clippy_lints/src/repeat_vec_with_capacity.rs Show resolved Hide resolved
@dswij
Copy link
Member

dswij commented Dec 1, 2023

Ran lintcheck, no repeat_vec_with_capacity seems to be emitted.

LGTM, thanks @y21!

@bors r+

@bors
Copy link
Collaborator

bors commented Dec 1, 2023

📌 Commit 76eb781 has been approved by dswij

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Dec 1, 2023

⌛ Testing commit 76eb781 with merge 5ac76ac...

@bors
Copy link
Collaborator

bors commented Dec 1, 2023

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: dswij
Pushing 5ac76ac to master...

@bors bors merged commit 5ac76ac into rust-lang:master Dec 1, 2023
8 checks passed
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

vec![Vec::with_capacity(x); n] has unintuitive behaviour.
4 participants