Skip to content

Commit

Permalink
remove useless drops in receivers
Browse files Browse the repository at this point in the history
  • Loading branch information
fereidani committed Jul 15, 2022
1 parent 33065e5 commit 9a8f990
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,6 @@ impl<T> Receiver<T> {
internal.push_recv(sig.as_signal());
drop(internal);
if !sig.wait() {
// receiving data was not successful so calling drop on uninited is undefined behavior
if std::mem::needs_drop::<T>() {
std::mem::forget(ret);
}
return Err(Error::ReceiveClosed);
}
Ok(unsafe { ret.assume_init() })
Expand Down Expand Up @@ -323,10 +319,6 @@ impl<T> AsyncReceiver<T> {
let sig = sig.deref();
let sync_wait = sig.wait_sync();
if sync_wait >= 1 && (sync_wait == 2 || sig.await != 0) {
// receiving data was not successful so calling drop on uninited is undefined behavior
if std::mem::needs_drop::<T>() {
std::mem::forget(ret);
}
return Err(Error::ReceiveClosed);
}
Ok(unsafe { ret.assume_init() })
Expand Down

0 comments on commit 9a8f990

Please sign in to comment.