Use .take() rather than replace(..., None) (#412)

Fixes clippy lint
This commit is contained in:
Gwilym Inzani 2023-04-12 14:13:16 +01:00 committed by GitHub
commit 6431896aee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -11,7 +11,6 @@ impl<T> Singleton<T> {
Singleton { single: None }
}
pub fn take(&mut self) -> T {
let g = core::mem::replace(&mut self.single, None);
g.unwrap()
self.single.take().unwrap()
}
}