Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/cargo/core/compiler/unit_dependencies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,7 @@ fn calc_deps_of_std(
deps_of_roots(roots, &mut state)?;
}
state.is_std = false;
Ok(Some(std::mem::replace(
&mut state.unit_dependencies,
HashMap::new(),
)))
Ok(Some(std::mem::take(&mut state.unit_dependencies)))
}

/// Add the standard library units to the `unit_dependencies`.
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/core/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ impl<'a, 'cfg> Downloads<'a, 'cfg> {
.pending
.remove(&token)
.expect("got a token for a non-in-progress transfer");
let data = mem::replace(&mut *dl.data.borrow_mut(), Vec::new());
let data = mem::take(&mut *dl.data.borrow_mut());
let mut handle = self.set.multi.remove(handle)?;
self.pending_ids.remove(&dl.id);

Expand Down
3 changes: 1 addition & 2 deletions src/cargo/core/summary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,7 @@ impl Summary {
{
{
let slot = &mut Rc::make_mut(&mut self.inner).dependencies;
let deps = mem::replace(slot, Vec::new());
*slot = deps.into_iter().map(f).collect();
*slot = mem::take(slot).into_iter().map(f).collect();
}
self
}
Expand Down
6 changes: 2 additions & 4 deletions src/cargo/util/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1452,12 +1452,10 @@ impl ConfigValue {
fn merge(&mut self, from: ConfigValue, force: bool) -> CargoResult<()> {
match (self, from) {
(&mut CV::List(ref mut old, _), CV::List(ref mut new, _)) => {
let new = mem::replace(new, Vec::new());
old.extend(new.into_iter());
old.extend(mem::take(new).into_iter());
}
(&mut CV::Table(ref mut old, _), CV::Table(ref mut new, _)) => {
let new = mem::replace(new, HashMap::new());
for (key, value) in new {
for (key, value) in mem::take(new) {
match old.entry(key.clone()) {
Occupied(mut entry) => {
let new_def = value.definition().clone();
Expand Down
6 changes: 1 addition & 5 deletions src/cargo/util/profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,7 @@ impl Drop for Profiler {
let duration = start.elapsed();
let duration_ms = duration.as_secs() * 1000 + u64::from(duration.subsec_millis());

let msg = (
stack_len,
duration_ms,
mem::replace(&mut self.desc, String::new()),
);
let msg = (stack_len, duration_ms, mem::take(&mut self.desc));
MESSAGES.with(|msgs| msgs.borrow_mut().push(msg));

if stack_len == 0 {
Expand Down