fix: use ready futures for synchronous trait handlers - #111
Open
lucarlig wants to merge 1 commit into
Open
Conversation
lucarlig
marked this pull request as ready for review
August 21, 2026 16:47
Signed-off-by: lucarlig <luca.carlig@ibm.com>
lucarlig
force-pushed
the
user/luca/fix-unused-async-handlers
branch
from
August 24, 2026 14:29
4ab6dc6 to
655bffb
Compare
dawid-nowak
reviewed
Aug 24, 2026
dawid-nowak
left a comment
Contributor
There was a problem hiding this comment.
Why are we returning a future if the interface is not async?
Or what am I missing?
dawid-nowak
reviewed
Aug 24, 2026
| _ctx: &mut PluginContext, | ||
| ) -> PluginResult<MessagePayload> { | ||
| ) -> impl std::future::Future<Output = PluginResult<MessagePayload>> { | ||
| let scan = self.scan_payload(payload); |
Contributor
There was a problem hiding this comment.
How about just adding and keeping the interface as it was.
Either adding :
async {}.await;
or
#[allow(clippy::unused_async_trait_impl)]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
std::future::Readyclippy::unused_async_trait_implenabled through the workspace pedantic lint groupThis is the bottom PR beneath #107 and #109.
Why
Clippy's
unused_async_trait_impldocumentation recommends returningstd::future::readywhen an async trait implementation contains no.await. This avoids generating an async state machine for work that is entirely synchronous.The change covers all nine affected functions: one production plugin handler and eight test or mock handlers. Their results are computed when the method is called and returned through
Ready; no lint suppression remains.Verification