diff --git a/src/once_cell.rs b/src/once_cell.rs index 8fcb7cb..dc3d69e 100644 --- a/src/once_cell.rs +++ b/src/once_cell.rs @@ -763,6 +763,14 @@ impl Drop for OnceCell { } } +impl Default for OnceCell { + // Calls `OnceCell::new`. + #[inline] + fn default() -> Self { + Self::new() + } +} + /// Either return the result of a future now, or panic. #[cfg(all(feature = "std", not(target_family = "wasm")))] fn now_or_never(f: impl Future) -> T {