matrix-rust-sdk icon indicating copy to clipboard operation
matrix-rust-sdk copied to clipboard

Ensure that most / all async methods in the SDK return futures that are `Send` (except on WASM)

Open jplatte opened this issue 1 year ago • 4 comments

Currently, we have #[cfg_attr(not(target_arch = "wasm32"), deny(clippy::future_not_send))] in a few select places. We should apply it more broadly and fix all of the issues it finds.

jplatte avatar Aug 09 '22 08:08 jplatte

We'll have to #[allow] this lint for generic functions (for now): https://github.com/rust-lang/rust-clippy/issues/6947

jplatte avatar Aug 25 '22 11:08 jplatte

Some progress is found here: https://github.com/matrix-org/matrix-rust-sdk/pull/3087

We're mostly Send, the matrix-sdk-crypto crate is the only major one that isn't and mostly because it uses generic functions, though needs to be more carefully investigated to be completely certain.

poljar avatar Feb 02 '24 13:02 poljar

Well spoke too soon, the main crate also has a bunch of them generic functions...

poljar avatar Feb 02 '24 13:02 poljar

The fix here is to adjust clippy to check that generic fns return a send future for send generic args, not for non-send generic args.

jplatte avatar Feb 02 '24 18:02 jplatte