Skip to content

New lint: vec_init_then_push - #6538

Merged
bors merged 4 commits into
rust-lang:masterfrom
Jarcho:vec_init_then_push
Jan 4, 2021
Merged

New lint: vec_init_then_push#6538
bors merged 4 commits into
rust-lang:masterfrom
Jarcho:vec_init_then_push

Conversation

@Jarcho

@Jarcho Jarcho commented Jan 2, 2021

Copy link
Copy Markdown
Contributor

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

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
Comment thread clippy_lints/src/vec_init_then_push.rs Outdated
Comment thread clippy_lints/src/vec_init_then_push.rs Outdated
@llogiq

llogiq commented Jan 3, 2021

Copy link
Copy Markdown
Contributor

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

llogiq commented Jan 4, 2021

Copy link
Copy Markdown
Contributor

Thank you! @bors r+

@bors

bors commented Jan 4, 2021

Copy link
Copy Markdown
Contributor

📌 Commit 7b5f549 has been approved by llogiq

@bors

bors commented Jan 4, 2021

Copy link
Copy Markdown
Contributor

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

@bors

bors commented Jan 4, 2021

Copy link
Copy Markdown
Contributor

☀️ 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