Skip to content

Commit

Permalink
refactor: use unwrap_or to simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcAntoine-Arnaud committed Feb 6, 2024
1 parent ef9da1b commit f5cb114
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions yaserde_derive/src/de/expand_enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,7 @@ pub fn parse(
}

::yaserde::__derive_debug!("Enum {} @ {}: success", stringify!(#name), start_depth);
match enum_value {
::std::option::Option::Some(value) => ::std::result::Result::Ok(value),
::std::option::Option::None => {
::std::result::Result::Ok(<#name as ::std::default::Default>::default())
},
}
::std::result::Result::Ok(enum_value.unwrap_or(<#name as ::std::default::Default>::default()))
}
}
}
Expand Down

0 comments on commit f5cb114

Please sign in to comment.