mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 21:23:56 +00:00
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
This commit is contained in:
commit
d732cce0d3
1 changed files with 6 additions and 12 deletions
|
@ -17,26 +17,20 @@ declare_clippy_lint! {
|
||||||
///
|
///
|
||||||
/// ### Example
|
/// ### Example
|
||||||
/// ```rust
|
/// ```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 trigger() {
|
||||||
///
|
/// large_future([0u8; 16 * 1024]).await;
|
||||||
/// pub async fn test() {
|
|
||||||
/// let fut = big_fut([0u8; 1024]);
|
|
||||||
/// wait(fut).await;
|
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// `Box::pin` the big future instead.
|
/// `Box::pin` the big future instead.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```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 trigger() {
|
||||||
///
|
/// Box::pin(large_future([0u8; 16 * 1024])).await;
|
||||||
/// pub async fn test() {
|
|
||||||
/// let fut = Box::pin(big_fut([0u8; 1024]));
|
|
||||||
/// wait(fut).await;
|
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
#[clippy::version = "1.70.0"]
|
#[clippy::version = "1.70.0"]
|
||||||
|
|
Loading…
Reference in a new issue