Enhance mem_replace_with_default with other constructors #6562
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
mem_replace_with_default
could recognize std library constructors that are equivalent toDefault::default()
such asVec::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())
The text was updated successfully, but these errors were encountered: