Adopt let else in more places

This commit is contained in:
est31
2022-02-19 00:48:49 +01:00
parent b8c56fa8c3
commit 2ef8af6619
132 changed files with 539 additions and 881 deletions

View File

@@ -2306,9 +2306,8 @@ impl crate::Decoder for Decoder {
}
json => bad!(ExpectedError("String or Object".to_owned(), json.to_string())),
};
let idx = match names.iter().position(|n| *n == &name[..]) {
Some(idx) => idx,
None => bad!(UnknownVariantError(name)),
let Some(idx) = names.iter().position(|n| *n == &name[..]) else {
bad!(UnknownVariantError(name));
};
f(self, idx)
}