diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2022-11-19 15:21:54 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-19 15:21:54 -0600 |
| commit | 619984fa33aec8b9629770928c51ee81a3d3a63f (patch) | |
| tree | fa6de3852d08dea6f77ba2549d98b9fcb457309a /azalea-chat/src/component.rs | |
| parent | befa22c1f3ff0c1f0cb745b3f4e736910c053a8b (diff) | |
| download | azalea-drasl-619984fa33aec8b9629770928c51ee81a3d3a63f.tar.xz | |
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
Diffstat (limited to 'azalea-chat/src/component.rs')
| -rwxr-xr-x | azalea-chat/src/component.rs | 25 |
1 files changed, 11 insertions, 14 deletions
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<Style> = Lazy::new(|| Style { + color: Some(ChatFormatting::White.try_into().unwrap()), + ..Style::default() +}); /// A chat component impl Component { |
