]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #105651 - tgross35:once-cell-inline, r=m-ou-se
authorbors <bors@rust-lang.org>
Fri, 30 Dec 2022 19:22:33 +0000 (19:22 +0000)
committerbors <bors@rust-lang.org>
Fri, 30 Dec 2022 19:22:33 +0000 (19:22 +0000)
Add #[inline] markers to once_cell methods

Added inline markers to all simple methods under the `once_cell` feature. Relates to #74465 and  #105587

This should not block #105587

1  2 
library/core/src/cell/lazy.rs
library/std/src/sync/lazy_lock.rs

Simple merge
index bf5a716fa03898dd344a31c46a89a2d643dcf226,b63f16820b7738ef91c2ffba7d67665db96798cc..4a15305301d69714badce18702986f90be660e18
@@@ -46,9 -46,11 +46,10 @@@ 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.
+     #[inline]
      #[unstable(feature = "once_cell", issue = "74465")]
      pub const fn new(f: F) -> LazyLock<T, F> {
          LazyLock { cell: OnceLock::new(), init: Cell::new(Some(f)) }