Bless clippy.
This commit is contained in:
parent
0a2d39de2e
commit
19e160fe2f
@ -7,8 +7,10 @@ async fn bad() -> u32 {
|
||||
}
|
||||
|
||||
async fn bad_reason() -> u32 {
|
||||
let _x = Ipv4Addr::new(127, 0, 0, 1);
|
||||
baz().await
|
||||
let x = Ipv4Addr::new(127, 0, 0, 1);
|
||||
let y = baz().await;
|
||||
let _x = x;
|
||||
y
|
||||
}
|
||||
|
||||
async fn good() -> u32 {
|
||||
|
@ -11,11 +11,11 @@ LL | let _x = String::from("hello");
|
||||
error: `std::net::Ipv4Addr` may not be held across an `await` point per `clippy.toml`
|
||||
--> $DIR/await_holding_invalid_type.rs:10:9
|
||||
|
|
||||
LL | let _x = Ipv4Addr::new(127, 0, 0, 1);
|
||||
| ^^
|
||||
LL | let x = Ipv4Addr::new(127, 0, 0, 1);
|
||||
| ^
|
||||
|
||||
error: `std::string::String` may not be held across an `await` point per `clippy.toml`
|
||||
--> $DIR/await_holding_invalid_type.rs:31:13
|
||||
--> $DIR/await_holding_invalid_type.rs:33:13
|
||||
|
|
||||
LL | let _x = String::from("hi!");
|
||||
| ^^
|
||||
|
@ -6,13 +6,10 @@ LL | let guard = x.lock().unwrap();
|
||||
|
|
||||
= help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await
|
||||
note: these are all the `await` points this lock is held through
|
||||
--> $DIR/await_holding_lock.rs:9:9
|
||||
--> $DIR/await_holding_lock.rs:11:15
|
||||
|
|
||||
LL | / let guard = x.lock().unwrap();
|
||||
LL | |
|
||||
LL | | baz().await
|
||||
LL | | }
|
||||
| |_____^
|
||||
LL | baz().await
|
||||
| ^^^^^
|
||||
= note: `-D clippy::await-holding-lock` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::await_holding_lock)]`
|
||||
|
||||
@ -24,13 +21,10 @@ LL | let guard = x.read().unwrap();
|
||||
|
|
||||
= help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await
|
||||
note: these are all the `await` points this lock is held through
|
||||
--> $DIR/await_holding_lock.rs:25:9
|
||||
--> $DIR/await_holding_lock.rs:27:15
|
||||
|
|
||||
LL | / let guard = x.read().unwrap();
|
||||
LL | |
|
||||
LL | | baz().await
|
||||
LL | | }
|
||||
| |_____^
|
||||
LL | baz().await
|
||||
| ^^^^^
|
||||
|
||||
error: this `MutexGuard` is held across an `await` point
|
||||
--> $DIR/await_holding_lock.rs:31:13
|
||||
@ -40,13 +34,10 @@ LL | let mut guard = x.write().unwrap();
|
||||
|
|
||||
= help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await
|
||||
note: these are all the `await` points this lock is held through
|
||||
--> $DIR/await_holding_lock.rs:31:9
|
||||
--> $DIR/await_holding_lock.rs:33:15
|
||||
|
|
||||
LL | / let mut guard = x.write().unwrap();
|
||||
LL | |
|
||||
LL | | baz().await
|
||||
LL | | }
|
||||
| |_____^
|
||||
LL | baz().await
|
||||
| ^^^^^
|
||||
|
||||
error: this `MutexGuard` is held across an `await` point
|
||||
--> $DIR/await_holding_lock.rs:53:13
|
||||
@ -56,16 +47,13 @@ LL | let guard = x.lock().unwrap();
|
||||
|
|
||||
= help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await
|
||||
note: these are all the `await` points this lock is held through
|
||||
--> $DIR/await_holding_lock.rs:53:9
|
||||
--> $DIR/await_holding_lock.rs:56:28
|
||||
|
|
||||
LL | / let guard = x.lock().unwrap();
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | let second = baz().await;
|
||||
... |
|
||||
LL | | first + second + third
|
||||
LL | | }
|
||||
| |_____^
|
||||
LL | let second = baz().await;
|
||||
| ^^^^^
|
||||
LL |
|
||||
LL | let third = baz().await;
|
||||
| ^^^^^
|
||||
|
||||
error: this `MutexGuard` is held across an `await` point
|
||||
--> $DIR/await_holding_lock.rs:67:17
|
||||
@ -75,13 +63,10 @@ LL | let guard = x.lock().unwrap();
|
||||
|
|
||||
= help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await
|
||||
note: these are all the `await` points this lock is held through
|
||||
--> $DIR/await_holding_lock.rs:67:13
|
||||
--> $DIR/await_holding_lock.rs:69:19
|
||||
|
|
||||
LL | / let guard = x.lock().unwrap();
|
||||
LL | |
|
||||
LL | | baz().await
|
||||
LL | | };
|
||||
| |_________^
|
||||
LL | baz().await
|
||||
| ^^^^^
|
||||
|
||||
error: this `MutexGuard` is held across an `await` point
|
||||
--> $DIR/await_holding_lock.rs:80:17
|
||||
@ -91,13 +76,10 @@ LL | let guard = x.lock().unwrap();
|
||||
|
|
||||
= help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await
|
||||
note: these are all the `await` points this lock is held through
|
||||
--> $DIR/await_holding_lock.rs:80:13
|
||||
--> $DIR/await_holding_lock.rs:82:19
|
||||
|
|
||||
LL | / let guard = x.lock().unwrap();
|
||||
LL | |
|
||||
LL | | baz().await
|
||||
LL | | }
|
||||
| |_________^
|
||||
LL | baz().await
|
||||
| ^^^^^
|
||||
|
||||
error: this `MutexGuard` is held across an `await` point
|
||||
--> $DIR/await_holding_lock.rs:93:13
|
||||
@ -107,13 +89,10 @@ LL | let guard = x.lock();
|
||||
|
|
||||
= help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await
|
||||
note: these are all the `await` points this lock is held through
|
||||
--> $DIR/await_holding_lock.rs:93:9
|
||||
--> $DIR/await_holding_lock.rs:95:15
|
||||
|
|
||||
LL | / let guard = x.lock();
|
||||
LL | |
|
||||
LL | | baz().await
|
||||
LL | | }
|
||||
| |_____^
|
||||
LL | baz().await
|
||||
| ^^^^^
|
||||
|
||||
error: this `MutexGuard` is held across an `await` point
|
||||
--> $DIR/await_holding_lock.rs:109:13
|
||||
@ -123,13 +102,10 @@ LL | let guard = x.read();
|
||||
|
|
||||
= help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await
|
||||
note: these are all the `await` points this lock is held through
|
||||
--> $DIR/await_holding_lock.rs:109:9
|
||||
--> $DIR/await_holding_lock.rs:111:15
|
||||
|
|
||||
LL | / let guard = x.read();
|
||||
LL | |
|
||||
LL | | baz().await
|
||||
LL | | }
|
||||
| |_____^
|
||||
LL | baz().await
|
||||
| ^^^^^
|
||||
|
||||
error: this `MutexGuard` is held across an `await` point
|
||||
--> $DIR/await_holding_lock.rs:115:13
|
||||
@ -139,13 +115,10 @@ LL | let mut guard = x.write();
|
||||
|
|
||||
= help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await
|
||||
note: these are all the `await` points this lock is held through
|
||||
--> $DIR/await_holding_lock.rs:115:9
|
||||
--> $DIR/await_holding_lock.rs:117:15
|
||||
|
|
||||
LL | / let mut guard = x.write();
|
||||
LL | |
|
||||
LL | | baz().await
|
||||
LL | | }
|
||||
| |_____^
|
||||
LL | baz().await
|
||||
| ^^^^^
|
||||
|
||||
error: this `MutexGuard` is held across an `await` point
|
||||
--> $DIR/await_holding_lock.rs:137:13
|
||||
@ -155,16 +128,13 @@ LL | let guard = x.lock();
|
||||
|
|
||||
= help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await
|
||||
note: these are all the `await` points this lock is held through
|
||||
--> $DIR/await_holding_lock.rs:137:9
|
||||
--> $DIR/await_holding_lock.rs:140:28
|
||||
|
|
||||
LL | / let guard = x.lock();
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | let second = baz().await;
|
||||
... |
|
||||
LL | | first + second + third
|
||||
LL | | }
|
||||
| |_____^
|
||||
LL | let second = baz().await;
|
||||
| ^^^^^
|
||||
LL |
|
||||
LL | let third = baz().await;
|
||||
| ^^^^^
|
||||
|
||||
error: this `MutexGuard` is held across an `await` point
|
||||
--> $DIR/await_holding_lock.rs:151:17
|
||||
@ -174,13 +144,10 @@ LL | let guard = x.lock();
|
||||
|
|
||||
= help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await
|
||||
note: these are all the `await` points this lock is held through
|
||||
--> $DIR/await_holding_lock.rs:151:13
|
||||
--> $DIR/await_holding_lock.rs:153:19
|
||||
|
|
||||
LL | / let guard = x.lock();
|
||||
LL | |
|
||||
LL | | baz().await
|
||||
LL | | };
|
||||
| |_________^
|
||||
LL | baz().await
|
||||
| ^^^^^
|
||||
|
||||
error: this `MutexGuard` is held across an `await` point
|
||||
--> $DIR/await_holding_lock.rs:164:17
|
||||
@ -190,13 +157,10 @@ LL | let guard = x.lock();
|
||||
|
|
||||
= help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await
|
||||
note: these are all the `await` points this lock is held through
|
||||
--> $DIR/await_holding_lock.rs:164:13
|
||||
--> $DIR/await_holding_lock.rs:166:19
|
||||
|
|
||||
LL | / let guard = x.lock();
|
||||
LL | |
|
||||
LL | | baz().await
|
||||
LL | | }
|
||||
| |_________^
|
||||
LL | baz().await
|
||||
| ^^^^^
|
||||
|
||||
error: this `MutexGuard` is held across an `await` point
|
||||
--> $DIR/await_holding_lock.rs:185:9
|
||||
@ -206,15 +170,10 @@ LL | let mut guard = x.lock().unwrap();
|
||||
|
|
||||
= help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await
|
||||
note: these are all the `await` points this lock is held through
|
||||
--> $DIR/await_holding_lock.rs:185:5
|
||||
--> $DIR/await_holding_lock.rs:189:11
|
||||
|
|
||||
LL | / let mut guard = x.lock().unwrap();
|
||||
LL | |
|
||||
LL | | *guard += 1;
|
||||
LL | | drop(guard);
|
||||
LL | | baz().await;
|
||||
LL | | }
|
||||
| |_^
|
||||
LL | baz().await;
|
||||
| ^^^^^
|
||||
|
||||
error: aborting due to 13 previous errors
|
||||
|
||||
|
@ -6,13 +6,10 @@ LL | let b = x.borrow();
|
||||
|
|
||||
= help: ensure the reference is dropped before calling `await`
|
||||
note: these are all the `await` points this reference is held through
|
||||
--> $DIR/await_holding_refcell_ref.rs:6:5
|
||||
--> $DIR/await_holding_refcell_ref.rs:8:11
|
||||
|
|
||||
LL | / let b = x.borrow();
|
||||
LL | |
|
||||
LL | | baz().await
|
||||
LL | | }
|
||||
| |_^
|
||||
LL | baz().await
|
||||
| ^^^^^
|
||||
= note: `-D clippy::await-holding-refcell-ref` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::await_holding_refcell_ref)]`
|
||||
|
||||
@ -24,13 +21,10 @@ LL | let b = x.borrow_mut();
|
||||
|
|
||||
= help: ensure the reference is dropped before calling `await`
|
||||
note: these are all the `await` points this reference is held through
|
||||
--> $DIR/await_holding_refcell_ref.rs:12:5
|
||||
--> $DIR/await_holding_refcell_ref.rs:14:11
|
||||
|
|
||||
LL | / let b = x.borrow_mut();
|
||||
LL | |
|
||||
LL | | baz().await
|
||||
LL | | }
|
||||
| |_^
|
||||
LL | baz().await
|
||||
| ^^^^^
|
||||
|
||||
error: this `RefCell` reference is held across an `await` point
|
||||
--> $DIR/await_holding_refcell_ref.rs:34:9
|
||||
@ -40,16 +34,13 @@ LL | let b = x.borrow_mut();
|
||||
|
|
||||
= help: ensure the reference is dropped before calling `await`
|
||||
note: these are all the `await` points this reference is held through
|
||||
--> $DIR/await_holding_refcell_ref.rs:34:5
|
||||
--> $DIR/await_holding_refcell_ref.rs:37:24
|
||||
|
|
||||
LL | / let b = x.borrow_mut();
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | let second = baz().await;
|
||||
... |
|
||||
LL | | first + second + third
|
||||
LL | | }
|
||||
| |_^
|
||||
LL | let second = baz().await;
|
||||
| ^^^^^
|
||||
LL |
|
||||
LL | let third = baz().await;
|
||||
| ^^^^^
|
||||
|
||||
error: this `RefCell` reference is held across an `await` point
|
||||
--> $DIR/await_holding_refcell_ref.rs:47:9
|
||||
@ -59,16 +50,10 @@ LL | let b = x.borrow_mut();
|
||||
|
|
||||
= help: ensure the reference is dropped before calling `await`
|
||||
note: these are all the `await` points this reference is held through
|
||||
--> $DIR/await_holding_refcell_ref.rs:47:5
|
||||
--> $DIR/await_holding_refcell_ref.rs:50:24
|
||||
|
|
||||
LL | / let b = x.borrow_mut();
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | let second = baz().await;
|
||||
... |
|
||||
LL | | first + second + third
|
||||
LL | | }
|
||||
| |_^
|
||||
LL | let second = baz().await;
|
||||
| ^^^^^
|
||||
|
||||
error: this `RefCell` reference is held across an `await` point
|
||||
--> $DIR/await_holding_refcell_ref.rs:63:13
|
||||
@ -78,13 +63,10 @@ LL | let b = x.borrow_mut();
|
||||
|
|
||||
= help: ensure the reference is dropped before calling `await`
|
||||
note: these are all the `await` points this reference is held through
|
||||
--> $DIR/await_holding_refcell_ref.rs:63:9
|
||||
--> $DIR/await_holding_refcell_ref.rs:65:15
|
||||
|
|
||||
LL | / let b = x.borrow_mut();
|
||||
LL | |
|
||||
LL | | baz().await
|
||||
LL | | };
|
||||
| |_____^
|
||||
LL | baz().await
|
||||
| ^^^^^
|
||||
|
||||
error: this `RefCell` reference is held across an `await` point
|
||||
--> $DIR/await_holding_refcell_ref.rs:76:13
|
||||
@ -94,13 +76,10 @@ LL | let b = x.borrow_mut();
|
||||
|
|
||||
= help: ensure the reference is dropped before calling `await`
|
||||
note: these are all the `await` points this reference is held through
|
||||
--> $DIR/await_holding_refcell_ref.rs:76:9
|
||||
--> $DIR/await_holding_refcell_ref.rs:78:15
|
||||
|
|
||||
LL | / let b = x.borrow_mut();
|
||||
LL | |
|
||||
LL | | baz().await
|
||||
LL | | }
|
||||
| |_____^
|
||||
LL | baz().await
|
||||
| ^^^^^
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
|
@ -59,6 +59,7 @@ async fn generic_future<T>(t: T) -> T
|
||||
{
|
||||
let rt = &t;
|
||||
async { true }.await;
|
||||
let _ = rt;
|
||||
t
|
||||
}
|
||||
|
||||
|
@ -12,19 +12,12 @@ LL | async fn private_future(rc: Rc<[u8]>, cell: &Cell<usize>) -> bool {
|
||||
LL |
|
||||
LL | async { true }.await
|
||||
| ^^^^^ await occurs here, with `rc` maybe used later
|
||||
LL | }
|
||||
| - `rc` is later dropped here
|
||||
= note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Send`
|
||||
note: future is not `Send` as this value is used across an await
|
||||
--> $DIR/future_not_send.rs:9:20
|
||||
note: captured value is not `Send` because `&` references cannot be sent unless their referent is `Sync`
|
||||
--> $DIR/future_not_send.rs:7:39
|
||||
|
|
||||
LL | async fn private_future(rc: Rc<[u8]>, cell: &Cell<usize>) -> bool {
|
||||
| ---- has type `&std::cell::Cell<usize>` which is not `Send`
|
||||
LL |
|
||||
LL | async { true }.await
|
||||
| ^^^^^ await occurs here, with `cell` maybe used later
|
||||
LL | }
|
||||
| - `cell` is later dropped here
|
||||
| ^^^^ has type `&std::cell::Cell<usize>` which is not `Send`, because `std::cell::Cell<usize>` is not `Sync`
|
||||
= note: `std::cell::Cell<usize>` doesn't implement `std::marker::Sync`
|
||||
= note: `-D clippy::future-not-send` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::future_not_send)]`
|
||||
@ -43,8 +36,6 @@ LL | pub async fn public_future(rc: Rc<[u8]>) {
|
||||
LL |
|
||||
LL | async { true }.await;
|
||||
| ^^^^^ await occurs here, with `rc` maybe used later
|
||||
LL | }
|
||||
| - `rc` is later dropped here
|
||||
= note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Send`
|
||||
|
||||
error: future cannot be sent between threads safely
|
||||
@ -93,9 +84,6 @@ LL | async fn private_future(&self) -> usize {
|
||||
LL |
|
||||
LL | async { true }.await;
|
||||
| ^^^^^ await occurs here, with `&self` maybe used later
|
||||
LL | self.rc.len()
|
||||
LL | }
|
||||
| - `&self` is later dropped here
|
||||
= note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Sync`
|
||||
|
||||
error: future cannot be sent between threads safely
|
||||
@ -104,16 +92,11 @@ error: future cannot be sent between threads safely
|
||||
LL | pub async fn public_future(&self) {
|
||||
| ^ future returned by `public_future` is not `Send`
|
||||
|
|
||||
note: future is not `Send` as this value is used across an await
|
||||
--> $DIR/future_not_send.rs:46:31
|
||||
note: captured value is not `Send` because `&` references cannot be sent unless their referent is `Sync`
|
||||
--> $DIR/future_not_send.rs:44:32
|
||||
|
|
||||
LL | pub async fn public_future(&self) {
|
||||
| ----- has type `&Dummy` which is not `Send`
|
||||
LL |
|
||||
LL | self.private_future().await;
|
||||
| ^^^^^ await occurs here, with `&self` maybe used later
|
||||
LL | }
|
||||
| - `&self` is later dropped here
|
||||
| ^^^^^ has type `&Dummy` which is not `Send`, because `Dummy` is not `Sync`
|
||||
= note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Sync`
|
||||
|
||||
error: future cannot be sent between threads safely
|
||||
@ -129,19 +112,16 @@ LL | let rt = &t;
|
||||
| -- has type `&T` which is not `Send`
|
||||
LL | async { true }.await;
|
||||
| ^^^^^ await occurs here, with `rt` maybe used later
|
||||
LL | t
|
||||
LL | }
|
||||
| - `rt` is later dropped here
|
||||
= note: `T` doesn't implement `std::marker::Sync`
|
||||
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/future_not_send.rs:72:34
|
||||
--> $DIR/future_not_send.rs:73:34
|
||||
|
|
||||
LL | async fn unclear_future<T>(t: T) {}
|
||||
| ^ future returned by `unclear_future` is not `Send`
|
||||
|
|
||||
note: captured value is not `Send`
|
||||
--> $DIR/future_not_send.rs:72:28
|
||||
--> $DIR/future_not_send.rs:73:28
|
||||
|
|
||||
LL | async fn unclear_future<T>(t: T) {}
|
||||
| ^ has type `T` which is not `Send`
|
||||
|
Loading…
Reference in New Issue
Block a user