mirror of
https://github.com/serai-dex/serai.git
synced 2025-01-03 17:40:34 +00:00
Update Rust nightly
Supersedes #368. Adds exceptions for unwrap_or_default due to preference against Default's ambiguity.
This commit is contained in:
parent
cd4c3a6c88
commit
f7e49e1f90
6 changed files with 10 additions and 1 deletions
2
.github/nightly-version
vendored
2
.github/nightly-version
vendored
|
@ -1 +1 @@
|
||||||
nightly-2023-08-01
|
nightly-2023-09-01
|
||||||
|
|
|
@ -35,6 +35,7 @@ impl<D: Db, T: TransactionTrait> Mempool<D, T> {
|
||||||
let tx_hash = tx.hash();
|
let tx_hash = tx.hash();
|
||||||
let transaction_key = self.transaction_key(&tx_hash);
|
let transaction_key = self.transaction_key(&tx_hash);
|
||||||
let current_mempool_key = self.current_mempool_key();
|
let current_mempool_key = self.current_mempool_key();
|
||||||
|
#[allow(clippy::unwrap_or_default)]
|
||||||
let mut current_mempool = self.db.get(¤t_mempool_key).unwrap_or(vec![]);
|
let mut current_mempool = self.db.get(¤t_mempool_key).unwrap_or(vec![]);
|
||||||
|
|
||||||
let mut txn = self.db.txn();
|
let mut txn = self.db.txn();
|
||||||
|
@ -225,6 +226,7 @@ impl<D: Db, T: TransactionTrait> Mempool<D, T> {
|
||||||
pub(crate) fn remove(&mut self, tx: &[u8; 32]) {
|
pub(crate) fn remove(&mut self, tx: &[u8; 32]) {
|
||||||
let transaction_key = self.transaction_key(tx);
|
let transaction_key = self.transaction_key(tx);
|
||||||
let current_mempool_key = self.current_mempool_key();
|
let current_mempool_key = self.current_mempool_key();
|
||||||
|
#[allow(clippy::unwrap_or_default)]
|
||||||
let current_mempool = self.db.get(¤t_mempool_key).unwrap_or(vec![]);
|
let current_mempool = self.db.get(¤t_mempool_key).unwrap_or(vec![]);
|
||||||
|
|
||||||
let mut i = 0;
|
let mut i = 0;
|
||||||
|
|
|
@ -77,6 +77,7 @@ impl<D: Db, T: Transaction> ProvidedTransactions<D, T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
let current_provided_key = self.current_provided_key();
|
let current_provided_key = self.current_provided_key();
|
||||||
|
#[allow(clippy::unwrap_or_default)]
|
||||||
let mut currently_provided = self.db.get(¤t_provided_key).unwrap_or(vec![]);
|
let mut currently_provided = self.db.get(¤t_provided_key).unwrap_or(vec![]);
|
||||||
|
|
||||||
let mut txn = self.db.txn();
|
let mut txn = self.db.txn();
|
||||||
|
|
|
@ -19,7 +19,10 @@ impl<N: Network> MessageLog<N> {
|
||||||
// Returns true if it's a new message
|
// Returns true if it's a new message
|
||||||
pub(crate) fn log(&mut self, signed: SignedMessageFor<N>) -> Result<bool, TendermintError<N>> {
|
pub(crate) fn log(&mut self, signed: SignedMessageFor<N>) -> Result<bool, TendermintError<N>> {
|
||||||
let msg = &signed.msg;
|
let msg = &signed.msg;
|
||||||
|
// Clarity, and safety around default != new edge cases
|
||||||
|
#[allow(clippy::unwrap_or_default)]
|
||||||
let round = self.log.entry(msg.round).or_insert_with(HashMap::new);
|
let round = self.log.entry(msg.round).or_insert_with(HashMap::new);
|
||||||
|
#[allow(clippy::unwrap_or_default)]
|
||||||
let msgs = round.entry(msg.sender).or_insert_with(HashMap::new);
|
let msgs = round.entry(msg.sender).or_insert_with(HashMap::new);
|
||||||
|
|
||||||
// Handle message replays without issue. It's only multiple messages which is malicious
|
// Handle message replays without issue. It's only multiple messages which is malicious
|
||||||
|
|
|
@ -179,6 +179,7 @@ impl<N: Network> Scheduler<N> {
|
||||||
|
|
||||||
let mut add_plan = |payments| {
|
let mut add_plan = |payments| {
|
||||||
let amount = payment_amounts(&payments);
|
let amount = payment_amounts(&payments);
|
||||||
|
#[allow(clippy::unwrap_or_default)]
|
||||||
self.queued_plans.entry(amount).or_insert(VecDeque::new()).push_back(payments);
|
self.queued_plans.entry(amount).or_insert(VecDeque::new()).push_back(payments);
|
||||||
amount
|
amount
|
||||||
};
|
};
|
||||||
|
@ -394,6 +395,7 @@ impl<N: Network> Scheduler<N> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::unwrap_or_default)]
|
||||||
self.plans.entry(actual).or_insert(VecDeque::new()).push_back(payments);
|
self.plans.entry(actual).or_insert(VecDeque::new()).push_back(payments);
|
||||||
|
|
||||||
// TODO: This shows how ridiculous the serialize function is
|
// TODO: This shows how ridiculous the serialize function is
|
||||||
|
|
|
@ -149,6 +149,7 @@ impl Serai {
|
||||||
block: [u8; 32],
|
block: [u8; 32],
|
||||||
) -> Result<Option<R>, SeraiError> {
|
) -> Result<Option<R>, SeraiError> {
|
||||||
let storage = self.0.storage();
|
let storage = self.0.storage();
|
||||||
|
#[allow(clippy::unwrap_or_default)]
|
||||||
let address = subxt::dynamic::storage(pallet, name, keys.unwrap_or(vec![]));
|
let address = subxt::dynamic::storage(pallet, name, keys.unwrap_or(vec![]));
|
||||||
debug_assert!(storage.validate(&address).is_ok(), "invalid storage address");
|
debug_assert!(storage.validate(&address).is_ok(), "invalid storage address");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue