From c23a457e72abe608715ac76f076f47dc42af07a5 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 30 May 2024 20:31:44 +0200 Subject: Merging upstream version 1.74.1+dfsg1. Signed-off-by: Daniel Baumann --- .../ui-toml/large_futures/large_futures.fixed | 27 ++++++++++++++++++++++ .../ui-toml/large_futures/large_futures.stderr | 1 + 2 files changed, 28 insertions(+) create mode 100644 src/tools/clippy/tests/ui-toml/large_futures/large_futures.fixed (limited to 'src/tools/clippy/tests/ui-toml/large_futures') diff --git a/src/tools/clippy/tests/ui-toml/large_futures/large_futures.fixed b/src/tools/clippy/tests/ui-toml/large_futures/large_futures.fixed new file mode 100644 index 000000000..7dea9fb95 --- /dev/null +++ b/src/tools/clippy/tests/ui-toml/large_futures/large_futures.fixed @@ -0,0 +1,27 @@ +#![warn(clippy::large_futures)] + +fn main() {} + +pub async fn should_warn() { + let x = [0u8; 1024]; + async {}.await; + dbg!(x); +} + +pub async fn should_not_warn() { + let x = [0u8; 1020]; + async {}.await; + dbg!(x); +} + +pub async fn bar() { + Box::pin(should_warn()).await; + + async { + let x = [0u8; 1024]; + dbg!(x); + } + .await; + + should_not_warn().await; +} diff --git a/src/tools/clippy/tests/ui-toml/large_futures/large_futures.stderr b/src/tools/clippy/tests/ui-toml/large_futures/large_futures.stderr index b92734de2..7a02fcdbd 100644 --- a/src/tools/clippy/tests/ui-toml/large_futures/large_futures.stderr +++ b/src/tools/clippy/tests/ui-toml/large_futures/large_futures.stderr @@ -5,6 +5,7 @@ LL | should_warn().await; | ^^^^^^^^^^^^^ help: consider `Box::pin` on it: `Box::pin(should_warn())` | = note: `-D clippy::large-futures` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(clippy::large_futures)]` error: aborting due to previous error -- cgit v1.2.3