Simply use drop instead of std::mem::drop

Co-authored-by: LeSeulArtichaut <leseulartichaut@gmail.com>
This commit is contained in:
Poliorcetics 2020-06-08 16:29:47 +02:00 committed by GitHub
parent 9c8f881ccd
commit fdef1a5915
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -139,7 +139,7 @@ use crate::sys_common::poison::{self, LockResult, TryLockError, TryLockResult};
/// // and the thread still has work to do. This allow other threads to
/// // start working on the data immediately, without waiting
/// // for the rest of the unrelated work to be done here.
/// std::mem::drop(data);
/// drop(data);
/// *res_mutex_clone.lock().unwrap() += result;
/// }));
/// });
@ -156,7 +156,7 @@ use crate::sys_common::poison::{self, LockResult, TryLockError, TryLockResult};
/// // It's even more important here because we `.join` the threads after that.
/// // If we had not dropped the lock, a thread could be waiting forever for
/// // it, causing a deadlock.
/// std::mem::drop(data);
/// drop(data);
/// // Here the lock is not assigned to a variable and so, even if the scope
/// // does not end after this line, the mutex is still released:
/// // there is no deadlock.