Skip to content

Commit

Permalink
feat: Implement Display for hash kind (#298)
Browse files Browse the repository at this point in the history
This helps 'clap' and allows for a little more type-safety during
declaration.
  • Loading branch information
Byron committed Jan 23, 2022
1 parent 003515f commit bc89fc7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions git-hash/src/lib.rs
Expand Up @@ -96,6 +96,14 @@ impl FromStr for Kind {
}
}

impl std::fmt::Display for Kind {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Kind::Sha1 => f.write_str("SHA1"),
}
}
}

impl Kind {
/// Returns the shortest hash we support
#[inline]
Expand Down

0 comments on commit bc89fc7

Please sign in to comment.