use std::mem::take(x) instead of std::mem::replace(x, Default::default()) (clippy::mem_replace_with_default)
This commit is contained in:
parent
2ad46acd7f
commit
d7a5c574b1
|
@ -62,8 +62,7 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
|
||||||
// `self.constraints`, but we also want to be mutating
|
// `self.constraints`, but we also want to be mutating
|
||||||
// `self.member_constraints`. For now, just swap out the value
|
// `self.member_constraints`. For now, just swap out the value
|
||||||
// we want and replace at the end.
|
// we want and replace at the end.
|
||||||
let mut tmp =
|
let mut tmp = std::mem::take(&mut self.constraints.member_constraints);
|
||||||
std::mem::replace(&mut self.constraints.member_constraints, Default::default());
|
|
||||||
for member_constraint in member_constraints {
|
for member_constraint in member_constraints {
|
||||||
tmp.push_constraint(member_constraint, |r| self.to_region_vid(r));
|
tmp.push_constraint(member_constraint, |r| self.to_region_vid(r));
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,10 +70,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
debug!("used_trait_imports({:?}) = {:?}", item_def_id, used_trait_imports);
|
debug!("used_trait_imports({:?}) = {:?}", item_def_id, used_trait_imports);
|
||||||
wbcx.typeck_results.used_trait_imports = used_trait_imports;
|
wbcx.typeck_results.used_trait_imports = used_trait_imports;
|
||||||
|
|
||||||
wbcx.typeck_results.closure_captures = mem::replace(
|
wbcx.typeck_results.closure_captures =
|
||||||
&mut self.typeck_results.borrow_mut().closure_captures,
|
mem::take(&mut self.typeck_results.borrow_mut().closure_captures);
|
||||||
Default::default(),
|
|
||||||
);
|
|
||||||
|
|
||||||
if self.is_tainted_by_errors() {
|
if self.is_tainted_by_errors() {
|
||||||
// FIXME(eddyb) keep track of `ErrorReported` from where the error was emitted.
|
// FIXME(eddyb) keep track of `ErrorReported` from where the error was emitted.
|
||||||
|
|
Loading…
Reference in New Issue