From b70fe1b23f5167d2b6270b78f1d1df301ebd1996 Mon Sep 17 00:00:00 2001 From: Andrew Walbran Date: Fri, 20 Sep 2024 15:30:08 +0100 Subject: Use std::sync::LazyLock rather than once_cell. This was recently stabilised in Rust 1.80. Test: Treehugger Change-Id: I3748566599fb7bb63a7fa14a604b1405406c519c --- libs/debugstore/rust/Android.bp | 1 - libs/debugstore/rust/src/core.rs | 8 +++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/libs/debugstore/rust/Android.bp b/libs/debugstore/rust/Android.bp index 55ba3c32d1..9475333a72 100644 --- a/libs/debugstore/rust/Android.bp +++ b/libs/debugstore/rust/Android.bp @@ -23,7 +23,6 @@ rust_defaults { rustlibs: [ "libcrossbeam_queue", "libparking_lot", - "libonce_cell", "libcxx", ], shared_libs: ["libutils"], diff --git a/libs/debugstore/rust/src/core.rs b/libs/debugstore/rust/src/core.rs index 1dfa512151..6bf79d4e57 100644 --- a/libs/debugstore/rust/src/core.rs +++ b/libs/debugstore/rust/src/core.rs @@ -17,12 +17,14 @@ use super::event::Event; use super::event_type::EventType; use super::storage::Storage; use crate::cxxffi::uptimeMillis; -use once_cell::sync::Lazy; use std::fmt; -use std::sync::atomic::{AtomicU64, Ordering}; +use std::sync::{ + atomic::{AtomicU64, Ordering}, + LazyLock, +}; // Lazily initialized static instance of DebugStore. -static INSTANCE: Lazy = Lazy::new(DebugStore::new); +static INSTANCE: LazyLock = LazyLock::new(DebugStore::new); /// The `DebugStore` struct is responsible for managing debug events and data. pub struct DebugStore { -- cgit v1.2.3-59-g8ed1b