mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-06 10:42:08 +00:00
Use Display
instead of custom to_string
This commit is contained in:
parent
28ef30f7a2
commit
9c10152c89
1 changed files with 28 additions and 18 deletions
|
@ -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]
|
||||
|
|
Loading…
Reference in a new issue