Skip to content

Commit

Permalink
Factorize Display trait for Added and Updated fields
Browse files Browse the repository at this point in the history
  • Loading branch information
Hukadan committed May 12, 2024
1 parent 9757c90 commit b762047
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/models/field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ impl fmt::Display for Field {
Some(name) => write!(f, "Store\t{}", name),
None => write!(f, "Store"),
},
Field::Added(date) => write!(f, "Added\t{}", date.format("%Y-%m-%d")),
Field::Updated(date) => write!(f, "Updated\t{}", date.format("%Y-%m-%d")),
Field::Added(date) | Field::Updated(date) => {
write!(f, "{}\t{}", self.field_name(), date.format("%Y-%m-%d"))
}
Field::Unknown(field) => match field {
Some(field) => {
write!(f, "Unknown field {}", field)
Expand Down

0 comments on commit b762047

Please sign in to comment.