Fix clippy::manual_map warning

This commit is contained in:
Taiki Endo 2022-01-08 21:35:11 +09:00
parent d106d4d581
commit b3e1ff86de
1 changed files with 1 additions and 5 deletions

View File

@ -272,11 +272,7 @@ impl<T> Mutex<T> {
/// # ;
/// ```
pub fn try_lock(&self) -> Option<MutexGuard<'_, T>> {
if let Some(guard) = self.0.try_lock() {
Some(MutexGuard(guard))
} else {
None
}
self.0.try_lock().map(MutexGuard)
}
/// Consumes the mutex, returning the underlying data.