From 3c515873d62a52c61d2b3823363845053f86ad5e Mon Sep 17 00:00:00 2001 From: jasl Date: Mon, 21 Aug 2023 12:20:34 +0800 Subject: [PATCH] Make cargo clippy happy --- pallets/phala/src/compute/stake_pool_v2.rs | 2 +- standalone/prb/src/tx.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pallets/phala/src/compute/stake_pool_v2.rs b/pallets/phala/src/compute/stake_pool_v2.rs index 61a47ebd20..5a44440432 100644 --- a/pallets/phala/src/compute/stake_pool_v2.rs +++ b/pallets/phala/src/compute/stake_pool_v2.rs @@ -804,7 +804,7 @@ pub mod pallet { // this nft's property shouldn't be accessed or wrote again from storage before set_nft_attr // is called. Or the property of the nft will be overwrote incorrectly. let mut nft_guard = - base_pool::Pallet::::get_nft_attr_guard(pool_info.basepool.cid, nft_id.into())?; + base_pool::Pallet::::get_nft_attr_guard(pool_info.basepool.cid, nft_id)?; let nft = &mut nft_guard.attr; let in_queue_shares = match pool_info .basepool diff --git a/standalone/prb/src/tx.rs b/standalone/prb/src/tx.rs index 9632b20d53..86251e5c2b 100644 --- a/standalone/prb/src/tx.rs +++ b/standalone/prb/src/tx.rs @@ -359,7 +359,7 @@ impl TxManager { let id = ids.get(idx).ok_or(UnknownDataMismatch)?; let tx = self.clone().tx_map.get(id).ok_or(UnknownDataMismatch)?; let mut tx = tx.lock().await; - let shot = std::mem::replace(&mut tx.shot, None).ok_or(UnknownDataMismatch)?; + let shot = tx.shot.take().ok_or(UnknownDataMismatch)?; tx.state = match &r { Ok(_) => TransactionState::Success(TransactionSuccess::default()), Err(e) => TransactionState::Error(e.into()), @@ -375,7 +375,7 @@ impl TxManager { for id in ids { let tx = self.clone().tx_map.get(&id).ok_or(UnknownDataMismatch)?; let mut tx = tx.lock().await; - let shot = std::mem::replace(&mut tx.shot, None).ok_or(UnknownDataMismatch)?; + let shot = tx.shot.take().ok_or(UnknownDataMismatch)?; tx.state = TransactionState::Error((&e).into()); if shot.send(Err(anyhow!(e.to_string()))).is_err() { return Err(anyhow!("shot can't be sent")); @@ -397,7 +397,7 @@ impl TxManager { for i in ids.iter() { let tx = self.tx_map.get(i).ok_or(UnknownDataMismatch)?; let mut tx = tx.lock().await; - let call = std::mem::replace(&mut tx.tx_payload, None).ok_or(UnknownDataMismatch)?; + let call = tx.tx_payload.take().ok_or(UnknownDataMismatch)?; calls.push(call); drop(tx); }