Rollup merge of #62249 - czipperz:use-mem-take-instead-of-replace-default, r=dtolnay,Centril

Use mem::take instead of mem::replace with default
This commit is contained in:
Mazdak Farrokhzad 2019-07-04 01:38:46 +02:00 committed by GitHub
commit 88c007cd04
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
43 changed files with 57 additions and 49 deletions

View file

@ -307,7 +307,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
} else {
self.resolve_imports();
if undetermined_invocations.is_empty() { break }
invocations = mem::replace(&mut undetermined_invocations, Vec::new());
invocations = mem::take(&mut undetermined_invocations);
force = !mem::replace(&mut progress, false);
continue
};

View file

@ -249,7 +249,7 @@ pub fn transcribe(
quoted::TokenTree::Delimited(mut span, delimited) => {
span = span.apply_mark(cx.current_expansion.mark);
stack.push(Frame::Delimited { forest: delimited, idx: 0, span });
result_stack.push(mem::replace(&mut result, Vec::new()));
result_stack.push(mem::take(&mut result));
}
// Nothing much to do here. Just push the token to the result, being careful to