Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Use `Display` instead of custom `to_string`
Marshall Bowers9c10152c89c3
diff --git a/crates/ui2/src/prelude.rs b/crates/ui2/src/prelude.rsindex 2be30ff05a0..141c20c5055 100644--- a/crates/ui2/src/prelude.rs+++ b/crates/ui2/src/prelude.rs@@ -26,13 +26,17 @@ pub enum FileSystemStatus {Deleted,}-impl FileSystemStatus {- pub fn to_string(&self) -> String {- match self {- Self::None => "None".to_string(),- Self::Conflict => "Conflict".to_string(),- Self::Deleted => "Deleted".to_string(),- }+impl std::fmt::Display for FileSystemStatus {+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {+ write!(+ f,+ "{}",+ match self {+ Self::None => "None",+ Self::Conflict => "Conflict",+ Self::Deleted => "Deleted",+ }+ )}}@@ -48,17 +52,6 @@ pub enum GitStatus {}impl GitStatus {- pub fn to_string(&self) -> String {- match self {- Self::None => "None".to_string(),- Self::Created => "Created".to_string(),- Self::Modified => "Modified".to_string(),- Self::Deleted => "Deleted".to_string(),- Self::Conflict => "Conflict".to_string(),- Self::Renamed => "Renamed".to_string(),- }- }-pub fn hsla(&self, cx: &WindowContext) -> Hsla {let theme = theme(cx);@@ -73,6 +66,23 @@ impl GitStatus {}}+impl std::fmt::Display for GitStatus {+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {+ write!(+ f,+ "{}",+ match self {+ Self::None => "None",+ Self::Created => "Created",+ Self::Modified => "Modified",+ Self::Deleted => "Deleted",+ Self::Conflict => "Conflict",+ Self::Renamed => "Renamed",+ }+ )+ }+}+#[derive(Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy, EnumIter)]pub enum DiagnosticStatus {#[default]