From 3fbbe5e93d0f7dbd828e8f071d7bfd092d4b2896 Mon Sep 17 00:00:00 2001 From: mat Date: Fri, 21 Oct 2022 22:30:19 -0500 Subject: have Display implemented for the Components --- azalea-chat/src/component.rs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'azalea-chat/src/component.rs') diff --git a/azalea-chat/src/component.rs b/azalea-chat/src/component.rs index 81224d9f..12df03cd 100755 --- a/azalea-chat/src/component.rs +++ b/azalea-chat/src/component.rs @@ -267,16 +267,9 @@ impl From for Component { impl Display for Component { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - // this contains the final string will all the ansi escape codes - for component in self.clone().into_iter() { - let component_text = match &component { - Self::Text(c) => c.text.to_string(), - Self::Translatable(c) => c.to_string(), - }; - - f.write_str(&component_text)?; + match self { + Component::Text(c) => c.fmt(f), + Component::Translatable(c) => c.fmt(f), } - - Ok(()) } } -- cgit v1.2.3