diff options
Diffstat (limited to 'src/tools/clippy/src/docs/unused_async.txt')
-rw-r--r-- | src/tools/clippy/src/docs/unused_async.txt | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/src/tools/clippy/src/docs/unused_async.txt b/src/tools/clippy/src/docs/unused_async.txt deleted file mode 100644 index 26def11aa..000000000 --- a/src/tools/clippy/src/docs/unused_async.txt +++ /dev/null @@ -1,23 +0,0 @@ -### What it does -Checks for functions that are declared `async` but have no `.await`s inside of them. - -### Why is this bad? -Async functions with no async code create overhead, both mentally and computationally. -Callers of async methods either need to be calling from an async function themselves or run it on an executor, both of which -causes runtime overhead and hassle for the caller. - -### Example -``` -async fn get_random_number() -> i64 { - 4 // Chosen by fair dice roll. Guaranteed to be random. -} -let number_future = get_random_number(); -``` - -Use instead: -``` -fn get_random_number_improved() -> i64 { - 4 // Chosen by fair dice roll. Guaranteed to be random. -} -let number_future = async { get_random_number_improved() }; -```
\ No newline at end of file |