Skip to content

Commit

Permalink
prost-derive: streamline Debug impl of enums
Browse files Browse the repository at this point in the history
  • Loading branch information
mzabaluev committed May 28, 2024
1 parent 1702c54 commit 9ec7c5d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions prost-derive/src/field/scalar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,9 @@ impl Field {
struct #wrap_name<'a>(&'a ::prost::OpenEnum<#ty>);
impl<'a> ::core::fmt::Debug for #wrap_name<'a> {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
let res = self.0.known_or(());
match res {
Err(_) => ::core::fmt::Debug::fmt(&self.0, f),
Ok(en) => ::core::fmt::Debug::fmt(&en, f),
match self.0.known() {
Some(en) => ::core::fmt::Debug::fmt(&en, f),
None => ::core::fmt::Debug::fmt(&self.0, f),
}
}
}
Expand Down

0 comments on commit 9ec7c5d

Please sign in to comment.