Clippy will suggest replacing
let x = mem::replace(&mut thing, Thing::default());
with:
let x = mem::take(&mut thing);
This is great! But it will also suggest replacing
mem::replace(&mut thing, Thing::default());
with:
This is not great. The construction using mem::replace in the second case is much clearer IMO as it indicates that the function is being executed for its side effects. The construction using mem::take looks like a mistake.
Would you folks be open to making the lint not apply in the second case?
Clippy will suggest replacing
with:
This is great! But it will also suggest replacing
with:
This is not great. The construction using
mem::replacein the second case is much clearer IMO as it indicates that the function is being executed for its side effects. The construction usingmem::takelooks like a mistake.Would you folks be open to making the lint not apply in the second case?