Remove retain_mut crate (#11926)

* Remove retain_mut crate

* Remove reain_mut crate from babe-consensus
This commit is contained in:
Sebastian Kunert
2022-07-28 00:35:33 +02:00
committed by GitHub
parent 72522429a7
commit c831138c0a
5 changed files with 24 additions and 38 deletions
@@ -20,7 +20,6 @@ linked-hash-map = "0.5.4"
log = "0.4.17"
parity-util-mem = { version = "0.11.0", default-features = false, features = ["primitive-types"] }
parking_lot = "0.12.0"
retain_mut = "0.1.4"
serde = { version = "1.0.136", features = ["derive"] }
thiserror = "1.0.30"
prometheus-endpoint = { package = "substrate-prometheus-endpoint", version = "0.10.0-dev", path = "../../utils/prometheus" }
@@ -24,7 +24,6 @@ use std::{
use futures::channel::mpsc::{channel, Sender};
use parking_lot::{Mutex, RwLock};
use retain_mut::RetainMut;
use sc_transaction_pool_api::{error, PoolStatus, ReadyTransactions};
use serde::Serialize;
use sp_runtime::{
@@ -204,21 +203,20 @@ impl<B: ChainApi> ValidatedPool<B> {
let imported = self.pool.write().import(tx)?;
if let base::Imported::Ready { ref hash, .. } = imported {
RetainMut::retain_mut(&mut *self.import_notification_sinks.lock(), |sink| {
match sink.try_send(*hash) {
Ok(()) => true,
Err(e) =>
if e.is_full() {
log::warn!(
target: "txpool",
"[{:?}] Trying to notify an import but the channel is full",
hash,
);
true
} else {
false
},
}
let sinks = &mut self.import_notification_sinks.lock();
sinks.retain_mut(|sink| match sink.try_send(*hash) {
Ok(()) => true,
Err(e) =>
if e.is_full() {
log::warn!(
target: "txpool",
"[{:?}] Trying to notify an import but the channel is full",
hash,
);
true
} else {
false
},
});
}