Closed asonix closed 6 years ago
Hello, I have migrated the match structures into the TryFrom implementation, Would you accept the following in place of your reccomended if statement?
for (os, value) in self.config.iter() {
let opsys = OS::try_from(os.as_ref());
build_os(&mut targets, opsys.expect(&format!("{}, is not a valid Operating System!",os)), value);
}
Try not to use 'expect' since we don't really want to have our program panic in these cases. Printing a message and ignoring the invalid target is probably better
Copy that, I'll make the modifications :>
Thanks, Aidan
On Dec 14, 2017 6:11 PM, "Riley Trautman" notifications@github.com wrote:
Try not to use 'expect' since we don't really want to have our program panic in these cases. Printing a message and ignoring the invalid target is probably better
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/asonix/release-manager/issues/4#issuecomment-351893309, or mute the thread https://github.com/notifications/unsubscribe-auth/AIKFgJqUC4Mw5UoZcHYf1HvKqliGCBfMks5tAdU4gaJpZM4RBWim .
Okay, Instead of 'expect' it now checks the result with 'is_err' before reaching inside it with 'unwrap.'
Nice, thanks!
Two places in the code (specifically for the
OS
andArch
enums, we have extended match structures that convert a given&str
into an enum discriminant. We can clean up the logic here by replacing these with something along the lines of: