Skip to content

Commit 4930b8b

Browse files
committed
mctp-estack: Don't use async when not needed
Removing async from these functions saves code size. Add a clippy::unused_async lint. Signed-off-by: Matt Johnston <[email protected]>
1 parent 4648498 commit 4930b8b

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

mctp-estack/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
// defmt does not currently allow inline format arguments, so we don't want
3535
// those reworked when using the log crate either.
3636
#![allow(clippy::uninlined_format_args)]
37+
#![warn(clippy::unused_async)]
3738

3839
#[cfg(test)]
3940
#[macro_use]

mctp-estack/src/router.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ impl PortTop {
144144
/// Do not call with locks held.
145145
/// May block waiting for a port queue to flush.
146146
/// Packet must be a valid MCTP packet, may panic otherwise.
147-
async fn forward_packet(&self, pkt: &[u8]) -> Result<()> {
147+
fn forward_packet(&self, pkt: &[u8]) -> Result<()> {
148148
debug_assert!(MctpHeader::decode(pkt).is_ok());
149149

150150
// With forwarded packets we don't want to block if
@@ -550,7 +550,7 @@ impl<'r> Router<'r> {
550550
match inner.stack.receive(pkt) {
551551
// Complete message
552552
Ok(Some(msg)) => {
553-
self.incoming_local(msg).await;
553+
self.incoming_local(msg);
554554
return ret_src;
555555
}
556556
// Fragment consumed, message is incomplete
@@ -577,25 +577,25 @@ impl<'r> Router<'r> {
577577
return ret_src;
578578
};
579579

580-
let _ = top.forward_packet(pkt).await;
580+
let _ = top.forward_packet(pkt);
581581
ret_src
582582
}
583583

584-
async fn incoming_local(&self, msg: MctpMessage<'_>) {
584+
fn incoming_local(&self, msg: MctpMessage<'_>) {
585585
trace!("incoming local, type {}", msg.typ.0);
586586
debug_assert!(
587587
msg.tag.is_owner() == msg.cookie().is_none(),
588588
"cookie set only for responses"
589589
);
590590

591591
if msg.tag.is_owner() {
592-
self.incoming_listener(msg).await
592+
self.incoming_listener(msg)
593593
} else {
594-
self.incoming_response(msg).await
594+
self.incoming_response(msg)
595595
}
596596
}
597597

598-
async fn incoming_listener(&self, mut msg: MctpMessage<'_>) {
598+
fn incoming_listener(&self, mut msg: MctpMessage<'_>) {
599599
// wake the packet listener
600600
self.app_listeners.lock(|a| {
601601
let mut a = a.borrow_mut();
@@ -615,7 +615,7 @@ impl<'r> Router<'r> {
615615
});
616616
}
617617

618-
async fn incoming_response(&self, mut msg: MctpMessage<'_>) {
618+
fn incoming_response(&self, mut msg: MctpMessage<'_>) {
619619
if let Some(cookie) = msg.cookie() {
620620
msg.retain();
621621
self.recv_wakers.wake(cookie);

0 commit comments

Comments
 (0)