]> git.lizzy.rs Git - rust.git/blobdiff - library/core/src/cell/lazy.rs
Auto merge of #105651 - tgross35:once-cell-inline, r=m-ou-se
[rust.git] / library / core / src / cell / lazy.rs
index 08dcac6dbe6f160082e16b87a2702c74b3bcdbd0..65d12c25c51a48a13c7ddb7de65e233447764827 100644 (file)
@@ -35,7 +35,7 @@ pub struct LazyCell<T, F = fn() -> T> {
     init: Cell<Option<F>>,
 }
 
-impl<T, F> LazyCell<T, F> {
+impl<T, F: FnOnce() -> T> LazyCell<T, F> {
     /// Creates a new lazy value with the given initializing function.
     ///
     /// # Examples
@@ -56,9 +56,7 @@ impl<T, F> LazyCell<T, F> {
     pub const fn new(init: F) -> LazyCell<T, F> {
         LazyCell { cell: OnceCell::new(), init: Cell::new(Some(init)) }
     }
-}
 
-impl<T, F: FnOnce() -> T> LazyCell<T, F> {
     /// Forces the evaluation of this lazy value and returns a reference to
     /// the result.
     ///