Skip to content

Commit

Permalink
Simplify memory swap (#847)
Browse files Browse the repository at this point in the history
@rolyatmax caught this, it may have been useful at some point but it no
longer is since we aren't doing anything with the result.
<!-- ELLIPSIS_HIDDEN -->

----

> [!IMPORTANT]
> Replace `std::mem::swap` with direct assignment in `set_sender()` in
`key_manager.rs`.
> 
>   - **Refactor**:
> - Replace `std::mem::swap` with direct assignment in `set_sender()` in
`key_manager.rs` for `handle` update.
> 
> <sup>This description was created by </sup>[<img alt="Ellipsis"
src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=jamsocket%2Fplane&utm_source=github&utm_medium=referral)<sup>
for 7ff7225. It will automatically
update as commits are pushed.</sup>

<!-- ELLIPSIS_HIDDEN -->
  • Loading branch information
paulgb authored Nov 20, 2024
1 parent 7d16a75 commit f85c123
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions plane/src/drone/key_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,14 @@ impl KeyManager {
self.sender.replace(sender);

for (backend, (acquired_key, handle)) in self.handles.iter_mut() {
let mut new_handle = GuardHandle::new(renew_key_loop(
let new_handle = GuardHandle::new(renew_key_loop(
acquired_key.clone(),
backend.clone(),
self.sender.clone(),
self.executor.clone(),
));

std::mem::swap(handle, &mut new_handle);
*handle = new_handle;
}
}

Expand Down

0 comments on commit f85c123

Please sign in to comment.