diff options
| author | mat <git@matdoes.dev> | 2025-02-22 23:01:54 +0000 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-02-22 23:01:54 +0000 |
| commit | 34f53baf85fb5c7163ec5d71a8ab9d45d3f271b6 (patch) | |
| tree | 7920fec1203e8e96463a142f5f6da6164e76e684 /azalea-chat/src/style.rs | |
| parent | bdd2fc91e11e2896d8e1c7046df247e1075bd40d (diff) | |
| download | azalea-drasl-34f53baf85fb5c7163ec5d71a8ab9d45d3f271b6.tar.xz | |
update to rust edition 2024
Diffstat (limited to 'azalea-chat/src/style.rs')
| -rwxr-xr-x | azalea-chat/src/style.rs | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/azalea-chat/src/style.rs b/azalea-chat/src/style.rs index 57fe76a0..26fa2633 100755 --- a/azalea-chat/src/style.rs +++ b/azalea-chat/src/style.rs @@ -2,7 +2,7 @@ use std::{collections::HashMap, fmt, sync::LazyLock}; #[cfg(feature = "azalea-buf")] use azalea_buf::AzBuf; -use serde::{ser::SerializeStruct, Serialize, Serializer}; +use serde::{Serialize, Serializer, ser::SerializeStruct}; use serde_json::Value; #[cfg(feature = "simdnbt")] use simdnbt::owned::{NbtCompound, NbtTag}; @@ -334,10 +334,15 @@ fn simdnbt_serialize_field( default: impl simdnbt::ToNbtTag, reset: bool, ) { - if let Some(value) = value { - compound.insert(name, value); - } else if reset { - compound.insert(name, default); + match value { + Some(value) => { + compound.insert(name, value); + } + _ => { + if reset { + compound.insert(name, default); + } + } } } |
