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.
There is a warning from the compiler that reproduces in this test:
bon/bon/tests/integration/builder/mod.rs
Lines 36 to 46 in d59ff12
It is shown only when you enable the
clippy::future_not_sendclippy lint. The problem is that the generic param that implementsIntoSetis captured by the future when instead we should do that conversion outside of the future. Thefinish_fnmethod needs to return animpl Futurewith anasync move {}block at the end.