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

Unnecessary Vec/VecDeque reserve lint #8982

Open
leonardo-m opened this issue Jun 10, 2022 · 5 comments
Open

Unnecessary Vec/VecDeque reserve lint #8982

leonardo-m opened this issue Jun 10, 2022 · 5 comments
Assignees
Labels
A-lint Area: New lints

Comments

@leonardo-m
Copy link

leonardo-m commented Jun 10, 2022

What it does

Inspired by:
rust-lang/rust#97922

In a basic case like this Clippy could suggest to remove the call to reserve() because it's unnecessary:

Lint Name

unnecessary_reserve

Category

pedantic

Advantage

No response

Drawbacks

No response

Example

fn test1(v: &mut Vec<u32>, b: &[u32]) {
    v.reserve(b.len());
    v.extend(b);
}

The same for VecDeque.

@leonardo-m leonardo-m added the A-lint Area: New lints label Jun 10, 2022
@kyoto7250
Copy link
Contributor

@rustbot claim

@xFrednet
Copy link
Member

#9073 is the start of an implementation. The PR was closed due to inactivity. It might be a good reference point, if someone else wants to give this a go :)

@chansuke
Copy link
Contributor

@rustbot claim

@jonboh
Copy link
Contributor

jonboh commented Oct 15, 2023

@chansuke do you mind if I take over this?

@xFrednet
Copy link
Member

Since there hasn't been any activity since the start of this year, it's safe to assume that you can have this issue. I'll assign you to it 👍

@xFrednet xFrednet assigned jonboh and unassigned chansuke Oct 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints
Projects
None yet
5 participants