Skip to content

Commit fdef1a5

Browse files
Simply use drop instead of std::mem::drop
Co-authored-by: LeSeulArtichaut <[email protected]>
1 parent 9c8f881 commit fdef1a5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/libstd/sync/mutex.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ use crate::sys_common::poison::{self, LockResult, TryLockError, TryLockResult};
139139
/// // and the thread still has work to do. This allow other threads to
140140
/// // start working on the data immediately, without waiting
141141
/// // for the rest of the unrelated work to be done here.
142-
/// std::mem::drop(data);
142+
/// drop(data);
143143
/// *res_mutex_clone.lock().unwrap() += result;
144144
/// }));
145145
/// });
@@ -156,7 +156,7 @@ use crate::sys_common::poison::{self, LockResult, TryLockError, TryLockResult};
156156
/// // It's even more important here because we `.join` the threads after that.
157157
/// // If we had not dropped the lock, a thread could be waiting forever for
158158
/// // it, causing a deadlock.
159-
/// std::mem::drop(data);
159+
/// drop(data);
160160
/// // Here the lock is not assigned to a variable and so, even if the scope
161161
/// // does not end after this line, the mutex is still released:
162162
/// // there is no deadlock.

0 commit comments

Comments
 (0)