From 619984fa33aec8b9629770928c51ee81a3d3a63f Mon Sep 17 00:00:00 2001 From: mat <27899617+mat-1@users.noreply.github.com> Date: Sat, 19 Nov 2022 15:21:54 -0600 Subject: Replace lazy_static with once_cell::sync::Lazy (#43) * Remove lazy_static in azalea-chat * replace lazy_static with once_cell everywhere * fix * fix import * ignore a clippy warning in shape codegen --- azalea-chat/src/component.rs | 25 +++++++++++-------------- azalea-chat/src/lib.rs | 3 --- azalea-chat/src/style.rs | 22 +++++++++++----------- 3 files changed, 22 insertions(+), 28 deletions(-) (limited to 'azalea-chat/src') diff --git a/azalea-chat/src/component.rs b/azalea-chat/src/component.rs index e4c0ab72..882a521a 100755 --- a/azalea-chat/src/component.rs +++ b/azalea-chat/src/component.rs @@ -1,17 +1,16 @@ -use std::{ - fmt::Display, - io::{Cursor, Write}, -}; - -use azalea_buf::{BufReadError, McBufReadable, McBufWritable}; -use serde::{de, Deserialize, Deserializer}; - use crate::{ base_component::BaseComponent, style::{ChatFormatting, Style}, text_component::TextComponent, translatable_component::{StringOrComponent, TranslatableComponent}, }; +use azalea_buf::{BufReadError, McBufReadable, McBufWritable}; +use once_cell::sync::Lazy; +use serde::{de, Deserialize, Deserializer}; +use std::{ + fmt::Display, + io::{Cursor, Write}, +}; /// A chat component, basically anything you can see in chat. #[derive(Clone, Debug)] @@ -20,12 +19,10 @@ pub enum Component { Translatable(TranslatableComponent), } -lazy_static! { - pub static ref DEFAULT_STYLE: Style = Style { - color: Some(ChatFormatting::White.try_into().unwrap()), - ..Style::default() - }; -} +pub static DEFAULT_STYLE: Lazy