Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Enhance mem_replace_with_default with other constructors #6562

Closed
camsteffen opened this issue Jan 7, 2021 · 1 comment · Fixed by #6820
Closed

Enhance mem_replace_with_default with other constructors #6562

camsteffen opened this issue Jan 7, 2021 · 1 comment · Fixed by #6820
Assignees
Labels
C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages good-first-issue These issues are a good way to get started with Clippy I-false-negative Issue: The lint should have been triggered on code, but wasn't

Comments

@camsteffen
Copy link
Contributor

camsteffen commented Jan 7, 2021

mem_replace_with_default could recognize std library constructors that are equivalent to Default::default() such as Vec::new(), HashMap::new(), etc. This may also apply to #3812 when it is implemented, and the two lints may share a list of known "default-equivalent" constructors. vec![] should also be recognized.

Example: std::mem::replace(&mut v, Vec::new())

@camsteffen camsteffen added good-first-issue These issues are a good way to get started with Clippy C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages I-false-negative Issue: The lint should have been triggered on code, but wasn't labels Jan 7, 2021
@mgacek8
Copy link
Contributor

mgacek8 commented Mar 1, 2021

Hi, I'll give it a shot!
@rustbot claim

m-ou-se added a commit to m-ou-se/rust that referenced this issue Mar 5, 2021
…_to_Default_trait, r=oli-obk

Add diagnostic item to `Default` trait

This PR adds diagnostic item to `Default` trait to be used by rust-lang/rust-clippy#6562 issue.
Also fixes the obsolete path to the `symbols.rs` file in the comment.
m-ou-se added a commit to m-ou-se/rust that referenced this issue Mar 5, 2021
…_to_Default_trait, r=oli-obk

Add diagnostic item to `Default` trait

This PR adds diagnostic item to `Default` trait to be used by rust-lang/rust-clippy#6562 issue.
Also fixes the obsolete path to the `symbols.rs` file in the comment.
@bors bors closed this as completed in 92b9677 Mar 13, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages good-first-issue These issues are a good way to get started with Clippy I-false-negative Issue: The lint should have been triggered on code, but wasn't
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants