Skip to content

Commit d732cce

Browse files
committed
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
2 parents 50139e6 + 7e46fb9 commit d732cce

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

clippy_lints/src/large_futures.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,20 @@ declare_clippy_lint! {
1717
///
1818
/// ### Example
1919
/// ```rust
20-
/// async fn wait(f: impl std::future::Future<Output = ()>) {}
20+
/// async fn large_future(_x: [u8; 16 * 1024]) {}
2121
///
22-
/// async fn big_fut(arg: [u8; 1024]) {}
23-
///
24-
/// pub async fn test() {
25-
/// let fut = big_fut([0u8; 1024]);
26-
/// wait(fut).await;
22+
/// pub async fn trigger() {
23+
/// large_future([0u8; 16 * 1024]).await;
2724
/// }
2825
/// ```
2926
///
3027
/// `Box::pin` the big future instead.
3128
///
3229
/// ```rust
33-
/// async fn wait(f: impl std::future::Future<Output = ()>) {}
34-
///
35-
/// async fn big_fut(arg: [u8; 1024]) {}
30+
/// async fn large_future(_x: [u8; 16 * 1024]) {}
3631
///
37-
/// pub async fn test() {
38-
/// let fut = Box::pin(big_fut([0u8; 1024]));
39-
/// wait(fut).await;
32+
/// pub async fn trigger() {
33+
/// Box::pin(large_future([0u8; 16 * 1024])).await;
4034
/// }
4135
/// ```
4236
#[clippy::version = "1.70.0"]

0 commit comments

Comments
 (0)