From 0817382098128adcecb77756a3c7cd1bd0066057 Mon Sep 17 00:00:00 2001 From: mat Date: Wed, 27 Nov 2024 10:26:40 +0000 Subject: [PATCH 1/3] replace once_cell with std:;sync::LazyLock --- Cargo.lock | 7 - Cargo.toml | 1 - azalea-auth/Cargo.toml | 2 - azalea-auth/src/sessionserver.rs | 5 +- azalea-chat/Cargo.toml | 5 +- azalea-chat/src/component.rs | 5 +- azalea-chat/src/style.rs | 9 +- azalea-client/Cargo.toml | 6 - azalea-client/src/chat.rs | 3 +- azalea-language/Cargo.toml | 2 - azalea-language/src/lib.rs | 8 +- azalea-physics/Cargo.toml | 5 - azalea-physics/src/collision/blocks.rs | 912 ++++++++++---------- azalea-protocol/Cargo.toml | 14 +- azalea-protocol/examples/handshake_proxy.rs | 7 +- azalea-registry/Cargo.toml | 1 - azalea-registry/src/tags/blocks.rs | 473 +++++----- azalea-registry/src/tags/fluids.rs | 11 +- azalea-registry/src/tags/items.rs | 467 +++++----- azalea-world/Cargo.toml | 8 +- azalea/src/pathfinder/goals.rs | 3 +- codegen/lib/code/shapes.py | 8 +- codegen/lib/code/tags.py | 5 +- 23 files changed, 989 insertions(+), 978 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 493365355..7e285f211 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -237,7 +237,6 @@ dependencies = [ "chrono", "env_logger", "md-5", - "once_cell", "reqwest", "rsa", "serde", @@ -306,7 +305,6 @@ dependencies = [ "azalea-buf", "azalea-language", "azalea-registry", - "once_cell", "serde", "serde_json", "simdnbt", @@ -337,7 +335,6 @@ dependencies = [ "bevy_time", "derive_more", "minecraft_folder_path", - "once_cell", "parking_lot", "regex", "reqwest", @@ -428,7 +425,6 @@ dependencies = [ name = "azalea-language" version = "0.10.3+mc1.21.1" dependencies = [ - "once_cell", "serde", "serde_json", ] @@ -445,7 +441,6 @@ dependencies = [ "azalea-world", "bevy_app", "bevy_ecs", - "once_cell", "parking_lot", "uuid", ] @@ -474,7 +469,6 @@ dependencies = [ "futures", "futures-lite", "log", - "once_cell", "serde", "serde_json", "simdnbt", @@ -503,7 +497,6 @@ version = "0.10.3+mc1.21.1" dependencies = [ "azalea-buf", "azalea-registry-macros", - "once_cell", "serde", "simdnbt", ] diff --git a/Cargo.toml b/Cargo.toml index 217d8ac78..af748c1e1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -48,7 +48,6 @@ minecraft_folder_path = "0.1.2" nohash-hasher = "0.2.0" num-bigint = "0.4.6" num-traits = "0.2.19" -once_cell = "1.20.2" parking_lot = "0.12.3" priority-queue = "2.1.1" proc-macro2 = "1.0.92" diff --git a/azalea-auth/Cargo.toml b/azalea-auth/Cargo.toml index 7eb38c198..6573081dc 100644 --- a/azalea-auth/Cargo.toml +++ b/azalea-auth/Cargo.toml @@ -14,8 +14,6 @@ azalea-crypto = { path = "../azalea-crypto", version = "0.10.0" } base64 = { workspace = true } chrono = { workspace = true, features = ["serde"] } md-5 = { workspace = true } -#num-bigint = { workspace = true } -once_cell = { workspace = true } reqwest = { workspace = true, features = ["json", "rustls-tls"] } rsa = { workspace = true } serde = { workspace = true, features = ["derive"] } diff --git a/azalea-auth/src/sessionserver.rs b/azalea-auth/src/sessionserver.rs index 9c73fbf0b..e7052e111 100755 --- a/azalea-auth/src/sessionserver.rs +++ b/azalea-auth/src/sessionserver.rs @@ -1,5 +1,6 @@ //! Tell Mojang you're joining a multiplayer server. -use once_cell::sync::Lazy; +use std::sync::LazyLock; + use reqwest::StatusCode; use serde::Deserialize; use serde_json::json; @@ -49,7 +50,7 @@ pub struct ForbiddenError { pub path: String, } -static REQWEST_CLIENT: Lazy = Lazy::new(reqwest::Client::new); +static REQWEST_CLIENT: LazyLock = LazyLock::new(reqwest::Client::new); /// Tell Mojang's servers that you are going to join a multiplayer server, /// which is required to join online-mode servers. The server ID is an empty diff --git a/azalea-chat/Cargo.toml b/azalea-chat/Cargo.toml index 6cd9c16ee..370a8862d 100644 --- a/azalea-chat/Cargo.toml +++ b/azalea-chat/Cargo.toml @@ -15,10 +15,11 @@ azalea-buf = ["dep:azalea-buf", "simdnbt"] numbers = ["dep:azalea-registry", "dep:simdnbt"] [dependencies] -azalea-buf = { path = "../azalea-buf", features = ["serde_json"], version = "0.10.0", optional = true } +azalea-buf = { path = "../azalea-buf", features = [ + "serde_json", +], version = "0.10.0", optional = true } azalea-language = { path = "../azalea-language", version = "0.10.0" } azalea-registry = { path = "../azalea-registry", version = "0.10.0", optional = true } -once_cell = { workspace = true } serde = { workspace = true, features = ["derive"] } serde_json = { workspace = true } simdnbt = { workspace = true, optional = true } diff --git a/azalea-chat/src/component.rs b/azalea-chat/src/component.rs index 84b5ed170..43614c771 100755 --- a/azalea-chat/src/component.rs +++ b/azalea-chat/src/component.rs @@ -1,8 +1,7 @@ -use std::fmt::Display; +use std::{fmt::Display, sync::LazyLock}; #[cfg(feature = "azalea-buf")] use azalea_buf::{BufReadError, McBufReadable, McBufWritable}; -use once_cell::sync::Lazy; use serde::{de, Deserialize, Deserializer, Serialize}; #[cfg(feature = "simdnbt")] use simdnbt::{Deserialize as _, FromNbtTag as _, Serialize as _}; @@ -23,7 +22,7 @@ pub enum FormattedText { Translatable(TranslatableComponent), } -pub static DEFAULT_STYLE: Lazy