refactor: use unwrap_or to simplify code
This commit is contained in:
parent
ef9da1b7ee
commit
f5cb114a71
@ -89,12 +89,7 @@ pub fn parse(
|
|||||||
}
|
}
|
||||||
|
|
||||||
::yaserde::__derive_debug!("Enum {} @ {}: success", stringify!(#name), start_depth);
|
::yaserde::__derive_debug!("Enum {} @ {}: success", stringify!(#name), start_depth);
|
||||||
match enum_value {
|
::std::result::Result::Ok(enum_value.unwrap_or(<#name as ::std::default::Default>::default()))
|
||||||
::std::option::Option::Some(value) => ::std::result::Result::Ok(value),
|
|
||||||
::std::option::Option::None => {
|
|
||||||
::std::result::Result::Ok(<#name as ::std::default::Default>::default())
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user