Skip to content

Commit

Permalink
Slight refactor in async runtime to remove a clone
Browse files Browse the repository at this point in the history
  • Loading branch information
twright committed Oct 16, 2024
1 parent 16ae768 commit 10d97e1
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/async_runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,10 @@ impl<SS: StreamSystem> AsyncVarExchange<SS> {
// be checked within the same lock acquisition as sending the data
// Return None if the data was not sent

let (typ, sender) = {
let binding = self.senders.read().unwrap();
binding.get(&var).unwrap().clone()
};
match data {
Some(inner_data) => {
let binding = self.senders.read().unwrap();
let (typ, sender) = binding.get(&var).unwrap();
assert_eq!(SS::TypeSystem::type_of_value(&inner_data), typ.clone());
let sender = sender.lock().unwrap();
let data_copy = inner_data.clone();
Expand Down

0 comments on commit 10d97e1

Please sign in to comment.