about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-09-22 21:19:28 +0000
committerbors <bors@rust-lang.org>2023-09-22 21:19:28 +0000
commitd732cce0d39d49ad07feb45d5f6d966a69d0147c (patch)
tree4f0034715d49304ddd2993f7ce5b239e903edb78
parent50139e6ad282b153439dd2ae6bf380484f60dfbf (diff)
parent7e46fb9a658ceb5120fdf0de8665e7cc19114d7f (diff)
downloadrust-d732cce0d39d49ad07feb45d5f6d966a69d0147c.tar.gz
rust-d732cce0d39d49ad07feb45d5f6d966a69d0147c.zip
Auto merge of #11553 - mickvangelderen:fix-large-futures-example, r=xFrednet
Fix large_futures example

The value used in the large_futures example was not large enough to trigger the lint given the default threshold. The example also contained more code than necessary. This PR changes the value size from 1kB to 16kB and reduces the example in size.

changelog: [`large_futures`]: Fix and simplify example
-rw-r--r--clippy_lints/src/large_futures.rs18
1 files changed, 6 insertions, 12 deletions
diff --git a/clippy_lints/src/large_futures.rs b/clippy_lints/src/large_futures.rs
index d67d5899350..19f1e08b57a 100644
--- a/clippy_lints/src/large_futures.rs
+++ b/clippy_lints/src/large_futures.rs
@@ -17,26 +17,20 @@ declare_clippy_lint! {
     ///
     /// ### Example
     /// ```rust
-    /// async fn wait(f: impl std::future::Future<Output = ()>) {}
+    /// async fn large_future(_x: [u8; 16 * 1024]) {}
     ///
-    /// async fn big_fut(arg: [u8; 1024]) {}
-    ///
-    /// pub async fn test() {
-    ///     let fut = big_fut([0u8; 1024]);
-    ///     wait(fut).await;
+    /// pub async fn trigger() {
+    ///     large_future([0u8; 16 * 1024]).await;
     /// }
     /// ```
     ///
     /// `Box::pin` the big future instead.
     ///
     /// ```rust
-    /// async fn wait(f: impl std::future::Future<Output = ()>) {}
-    ///
-    /// async fn big_fut(arg: [u8; 1024]) {}
+    /// async fn large_future(_x: [u8; 16 * 1024]) {}
     ///
-    /// pub async fn test() {
-    ///     let fut = Box::pin(big_fut([0u8; 1024]));
-    ///     wait(fut).await;
+    /// pub async fn trigger() {
+    ///     Box::pin(large_future([0u8; 16 * 1024])).await;
     /// }
     /// ```
     #[clippy::version = "1.70.0"]