Skip to content

Fix lint #2810

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

Closed
wants to merge 1 commit into from
Closed

Fix lint #2810

wants to merge 1 commit into from

Conversation

willbush
Copy link
Contributor

I noticed this lint when going through the https://github.com/rust-lang/rustup/blob/master/CONTRIBUTING.md and running the suggested clippy command.

[nix-shell:~/code/rustup]$ cargo --version
cargo 1.55.0-nightly (9233aa06c 2021-06-22)
[nix-shell:~/code/rustup]$ cargo clippy --all --all-features --all-targets -- -D warnings

... elided output

error: calls to `push` immediately after creation
   --> tests/mock/clitools.rs:626:5
    |
626 | /     let mut arg_strings: Vec<Box<str>> = Vec::new();
627 | |     arg_strings.push(name.to_owned().into_boxed_str());
    | |_______________________________________________________^ help: consider using the `vec![]` macro: `let mut arg_strings: Vec<Box<str>> = vec![..];`
    |
    = note: `-D clippy::vec-init-then-push` implied by `-D warnings`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#vec_init_then_push

```shell
[nix-shell:~/code/rustup]$ cargo --version
cargo 1.55.0-nightly (9233aa06c 2021-06-22)
[nix-shell:~/code/rustup]$ cargo clippy --all --all-features --all-targets -- -D warnings

... elided output

error: calls to `push` immediately after creation
   --> tests/mock/clitools.rs:626:5
    |
626 | /     let mut arg_strings: Vec<Box<str>> = Vec::new();
627 | |     arg_strings.push(name.to_owned().into_boxed_str());
    | |_______________________________________________________^ help: consider using the `vec![]` macro: `let mut arg_strings: Vec<Box<str>> = vec![..];`
    |
    = note: `-D clippy::vec-init-then-push` implied by `-D warnings`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#vec_init_then_push
```
@0xPoe
Copy link
Member

0xPoe commented Jun 30, 2021

Thanks for your contribution!

See: rust-lang/rust-clippy#7071

Currently we consider it a false positive.

@willbush willbush closed this Jun 30, 2021
@willbush willbush deleted the lint branch June 30, 2021 06:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants