Simplify some Option / Result / ? operator patterns (#8653)

* Simplify some Option / Result / ? operator patterns

When those match a combinator exactly.

Tool-aided by [comby-rust](https://github.com/huitseeker/comby-rust).

* adjust after review

* adjust post-review
This commit is contained in:
François Garillot
2021-04-23 09:36:10 -04:00
committed by GitHub
parent 541692c4a8
commit 052be8bbef
37 changed files with 77 additions and 188 deletions
+1 -4
View File
@@ -163,10 +163,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
who: &T::AccountId,
keep_alive: bool,
) -> Result<T::Balance, Error<T, I>> {
let details = match Asset::<T, I>::get(id) {
Some(details) => details,
None => return Err(Error::<T, I>::Unknown),
};
let details = Asset::<T, I>::get(id).ok_or_else(|| Error::<T, I>::Unknown)?;
ensure!(!details.is_frozen, Error::<T, I>::Frozen);
let account = Account::<T, I>::get(id, who);