Skip to content

Commit

Permalink
Warn about futures_executor::block_on
Browse files Browse the repository at this point in the history
It's almost always incorrect to use it.
  • Loading branch information
hrxi committed Nov 26, 2024
1 parent e496970 commit 7de9e07
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions clippy.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
[[disallowed-methods]]
path = "futures::executor::block_on"
reason = "calling asynchronous code from synchronous code is almost always an error, use `tokio::runtime::Handle::current().block_on` if it's not an error"

[[disallowed-methods]]
path = "futures_executor::block_on"
reason = "calling asynchronous code from synchronous code is almost always an error, use `tokio::runtime::Handle::current().block_on` if it's not an error"

[[disallowed-methods]]
path = "tokio::task::spawn"
reason = "use `nimiq_utils::spawn` instead, it is also supported in WASM environments"
Expand Down

0 comments on commit 7de9e07

Please sign in to comment.