@@ -9,7 +9,7 @@ use sp_runtime::{
9
9
DispatchError , DispatchResult ,
10
10
} ;
11
11
use sp_std:: {
12
- cmp:: { Eq , PartialEq } ,
12
+ cmp:: { Eq , Ordering , PartialEq } ,
13
13
fmt:: Debug ,
14
14
result,
15
15
} ;
@@ -301,16 +301,17 @@ pub trait NamedMultiReservableCurrency<AccountId>: MultiReservableCurrency<Accou
301
301
value : Self :: Balance ,
302
302
) -> DispatchResult {
303
303
let current = Self :: reserved_balance_named ( id, currency_id, who) ;
304
- if current > value {
305
- // we always have enough balance to unreserve here
306
- Self :: unreserve_named ( id, currency_id, who, current - value) ;
307
- Ok ( ( ) )
308
- } else if value > current {
309
- // we checked value > current
310
- Self :: reserve_named ( id, currency_id, who, value - current)
311
- } else {
312
- // current == value
313
- Ok ( ( ) )
304
+ match current. cmp ( & value) {
305
+ Ordering :: Less => {
306
+ // we checked value > current
307
+ Self :: reserve_named ( id, currency_id, who, value - current)
308
+ }
309
+ Ordering :: Equal => Ok ( ( ) ) ,
310
+ Ordering :: Greater => {
311
+ // we always have enough balance to unreserve here
312
+ Self :: unreserve_named ( id, currency_id, who, current - value) ;
313
+ Ok ( ( ) )
314
+ }
314
315
}
315
316
}
316
317
0 commit comments