From 3b994de2902c77c8d65f6b55d45aa8037876a72f Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Wed, 12 Feb 2025 10:00:31 -0700 Subject: [PATCH] deps: remove once_cell in favor of std functionality --- Cargo.lock | 3 --- Cargo.toml | 1 - config/Cargo.toml | 1 - config/src/version.rs | 6 +++--- wezterm-gui/Cargo.toml | 1 - wezterm-gui/src/glyphcache.rs | 5 ++--- wezterm-ssh/Cargo.toml | 1 - wezterm-ssh/tests/sshd.rs | 4 ++-- 8 files changed, 7 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 374d95bd8..14edc4518 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -955,7 +955,6 @@ dependencies = [ "mlua", "nix", "notify", - "once_cell", "ordered-float 4.6.0", "portable-pty", "promise", @@ -6591,7 +6590,6 @@ dependencies = [ "mux", "mux-lua", "nucleo-matcher", - "once_cell", "ordered-float 4.6.0", "parking_lot", "portable-pty", @@ -6740,7 +6738,6 @@ dependencies = [ "libc", "libssh-rs", "log", - "once_cell", "passfd", "portable-pty", "predicates", diff --git a/Cargo.toml b/Cargo.toml index eec91c948..b892aea07 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -151,7 +151,6 @@ objc = "0.2" objc2 = "0.6" objc2-foundation = "0.3" objc2-user-notifications = "0.3" -once_cell = "1.8" openssl = "0.10.57" ordered-float = "4.1" parking_lot = "0.12" diff --git a/config/Cargo.toml b/config/Cargo.toml index 882a0709a..6e140b1da 100644 --- a/config/Cargo.toml +++ b/config/Cargo.toml @@ -26,7 +26,6 @@ log.workspace = true luahelper.workspace = true mlua = {workspace=true, features=["vendored", "lua54", "async", "send", "serialize"]} notify.workspace = true -once_cell.workspace = true ordered-float = { workspace=true, features = ["serde"] } portable-pty = { workspace=true, features = ["serde_support"]} promise.workspace = true diff --git a/config/src/version.rs b/config/src/version.rs index dc4f7fc2d..897a37a2b 100644 --- a/config/src/version.rs +++ b/config/src/version.rs @@ -1,7 +1,7 @@ -use once_cell::sync::OnceCell; +use std::sync::OnceLock; -static VERSION: OnceCell<&'static str> = OnceCell::new(); -static TRIPLE: OnceCell<&'static str> = OnceCell::new(); +static VERSION: OnceLock<&'static str> = OnceLock::new(); +static TRIPLE: OnceLock<&'static str> = OnceLock::new(); pub fn assign_version_info(version: &'static str, triple: &'static str) { VERSION.set(version).unwrap(); diff --git a/wezterm-gui/Cargo.toml b/wezterm-gui/Cargo.toml index 907a8feaa..7265ea46f 100644 --- a/wezterm-gui/Cargo.toml +++ b/wezterm-gui/Cargo.toml @@ -66,7 +66,6 @@ mlua = {workspace=true, features=["send", "serialize"]} mux-lua.workspace = true mux.workspace = true nucleo-matcher.workspace = true -once_cell.workspace = true ordered-float.workspace = true parking_lot.workspace = true portable-pty = { workspace=true, features = ["serde_support"]} diff --git a/wezterm-gui/src/glyphcache.rs b/wezterm-gui/src/glyphcache.rs index b42a25959..c1a086250 100644 --- a/wezterm-gui/src/glyphcache.rs +++ b/wezterm-gui/src/glyphcache.rs @@ -13,7 +13,6 @@ use image::{ AnimationDecoder, DynamicImage, Frame, Frames, ImageDecoder, ImageFormat, ImageResult, Limits, }; use lfucache::LfuCache; -use once_cell::sync::Lazy; use ordered_float::NotNan; use std::cell::RefCell; use std::collections::HashMap; @@ -21,7 +20,7 @@ use std::io::Seek; use std::rc::Rc; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::mpsc::{sync_channel, Receiver, RecvTimeoutError, SyncSender, TryRecvError}; -use std::sync::{Arc, MutexGuard}; +use std::sync::{Arc, LazyLock, MutexGuard}; use std::time::{Duration, Instant}; use termwiz::color::RgbColor; use termwiz::image::{ImageData, ImageDataType}; @@ -385,7 +384,7 @@ struct FrameState { impl FrameState { fn new(rx: Receiver) -> Self { const BLACK_SIZE: usize = 8; - static BLACK: Lazy = Lazy::new(|| { + static BLACK: LazyLock = LazyLock::new(|| { let mut data = vec![]; for _ in 0..BLACK_SIZE * BLACK_SIZE { data.extend_from_slice(&[0, 0, 0, 0xff]); diff --git a/wezterm-ssh/Cargo.toml b/wezterm-ssh/Cargo.toml index 70053d706..2140cf58b 100644 --- a/wezterm-ssh/Cargo.toml +++ b/wezterm-ssh/Cargo.toml @@ -48,7 +48,6 @@ assert_fs.workspace = true clap.workspace = true env_logger.workspace = true k9.workspace = true -once_cell.workspace = true predicates.workspace = true rstest.workspace = true shell-words.workspace = true diff --git a/wezterm-ssh/tests/sshd.rs b/wezterm-ssh/tests/sshd.rs index 936feff8c..69c48b5a0 100644 --- a/wezterm-ssh/tests/sshd.rs +++ b/wezterm-ssh/tests/sshd.rs @@ -1,11 +1,11 @@ use assert_fs::prelude::*; use assert_fs::TempDir; -use once_cell::sync::Lazy; use rstest::*; use std::collections::HashMap; use std::io::Result as IoResult; use std::path::Path; use std::process::{Child, Command}; +use std::sync::LazyLock; use std::time::Duration; use wezterm_ssh::{Config, Session, SessionEvent}; @@ -28,7 +28,7 @@ fn allocate_port() -> u16 { listener.local_addr().unwrap().port() } -const USERNAME: Lazy = Lazy::new(whoami::username); +const USERNAME: LazyLock = LazyLock::new(whoami::username); pub struct SshKeygen;