]> git.lizzy.rs Git - rust.git/blobdiff - library/std/src/sync/lazy_lock.rs
Auto merge of #106296 - matthiaskrgr:rollup-ukdbqwx, r=matthiaskrgr
[rust.git] / library / std / src / sync / lazy_lock.rs
index c8d3289ca4a06986bd81ff1ea97ced5996745bd7..bf5a716fa03898dd344a31c46a89a2d643dcf226 100644 (file)
@@ -46,17 +46,14 @@ pub struct LazyLock<T, F = fn() -> T> {
     cell: OnceLock<T>,
     init: Cell<Option<F>>,
 }
-
-impl<T, F> LazyLock<T, F> {
+impl<T, F: FnOnce() -> T> LazyLock<T, F> {
     /// Creates a new lazy value with the given initializing
     /// function.
     #[unstable(feature = "once_cell", issue = "74465")]
     pub const fn new(f: F) -> LazyLock<T, F> {
         LazyLock { cell: OnceLock::new(), init: Cell::new(Some(f)) }
     }
-}
 
-impl<T, F: FnOnce() -> T> LazyLock<T, F> {
     /// Forces the evaluation of this lazy value and
     /// returns a reference to result. This is equivalent
     /// to the `Deref` impl, but is explicit.