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: vec_init_then_push #6538

Merged
merged 4 commits into from
Jan 4, 2021
Merged

Conversation

Jarcho
Copy link
Contributor

@Jarcho Jarcho commented Jan 2, 2021

fixes: #1483

This will trigger on new, default, and with_capacity when the given capacity is less than or equal to the number of push calls. Is there anything else this should trigger on?

changelog: Added lint: vec_init_then_push

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @llogiq (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jan 2, 2021
clippy_lints/src/vec_init_then_push.rs Outdated Show resolved Hide resolved
clippy_lints/src/vec_init_then_push.rs Outdated Show resolved Hide resolved
@llogiq
Copy link
Contributor

llogiq commented Jan 3, 2021

I like this addition! Just a small nit: I'd make use of inference to keep the docs lean.

Also I think the Changelog line in the PR description should be the last line.

@llogiq
Copy link
Contributor

llogiq commented Jan 4, 2021

Thank you! @bors r+

@bors
Copy link
Collaborator

bors commented Jan 4, 2021

📌 Commit 7b5f549 has been approved by llogiq

@bors
Copy link
Collaborator

bors commented Jan 4, 2021

⌛ Testing commit 7b5f549 with merge 976850b...

@bors
Copy link
Collaborator

bors commented Jan 4, 2021

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: llogiq
Pushing 976850b to master...

@bors bors merged commit 976850b into rust-lang:master Jan 4, 2021
@Jarcho Jarcho deleted the vec_init_then_push branch April 6, 2021 16:01
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.

Suggest vec![…] instead of wall of vector.push(…) calls
4 participants