mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 04:09:23 +00:00
Further expand clippy workspace lints
Achieves a notable amount of reduced async and clones.
This commit is contained in:
@@ -54,7 +54,7 @@ pub(crate) use self::clippy::*;
|
||||
*/
|
||||
pub(crate) fn queue_message(
|
||||
db: &mut Db,
|
||||
meta: Metadata,
|
||||
meta: &Metadata,
|
||||
msg: Vec<u8>,
|
||||
sig: SchnorrSignature<Ristretto>,
|
||||
) {
|
||||
@@ -115,7 +115,7 @@ pub(crate) fn queue_message(
|
||||
pub(crate) fn get_next_message(from: Service, to: Service) -> Option<QueuedMessage> {
|
||||
let queue_outer = QUEUES.read().unwrap();
|
||||
let queue = queue_outer[&(from, to)].read().unwrap();
|
||||
let next = queue.last_acknowledged().map(|i| i + 1).unwrap_or(0);
|
||||
let next = queue.last_acknowledged().map_or(0, |i| i + 1);
|
||||
queue.get_message(next)
|
||||
}
|
||||
|
||||
@@ -246,7 +246,7 @@ async fn main() {
|
||||
MessageQueueRequest::Queue { meta, msg, sig } => {
|
||||
queue_message(
|
||||
&mut db,
|
||||
meta,
|
||||
&meta,
|
||||
msg,
|
||||
SchnorrSignature::<Ristretto>::read(&mut sig.as_slice()).unwrap(),
|
||||
);
|
||||
|
||||
@@ -16,8 +16,7 @@ impl<D: Db> Queue<D> {
|
||||
self
|
||||
.0
|
||||
.get(self.message_count_key())
|
||||
.map(|bytes| u64::from_le_bytes(bytes.try_into().unwrap()))
|
||||
.unwrap_or(0)
|
||||
.map_or(0, |bytes| u64::from_le_bytes(bytes.try_into().unwrap()))
|
||||
}
|
||||
|
||||
fn last_acknowledged_key(&self) -> Vec<u8> {
|
||||
|
||||
Reference in New Issue
Block a user