Skip to content

Do IntoSet conversions outside of the future returned by the async function #100

@Veetaha

Description

@Veetaha

There is a warning from the compiler that reproduces in this test:

#[cfg(feature = "std")]
#[tokio::test]
async fn async_func() {
#[builder]
async fn sut<Fut: std::future::Future>(fut: Fut) -> Fut::Output {
fut.await
}
let actual = sut().fut(async { 42 }).call().await;
assert_eq!(actual, 42);
}

It is shown only when you enable the clippy::future_not_send clippy lint. The problem is that the generic param that implements IntoSet is captured by the future when instead we should do that conversion outside of the future. The finish_fn method needs to return an impl Future with an async move {} block at the end.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions