This commit is contained in:
Rob Ede 2021-09-01 20:57:00 +01:00
parent 30450a7b84
commit 2443c1f1f3
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933
1 changed files with 2 additions and 1 deletions

View File

@ -300,11 +300,12 @@ fn try_current_with_system() {
System::new().block_on(async { assert!(System::try_current().is_some()) }); System::new().block_on(async { assert!(System::try_current().is_some()) });
} }
#[allow(clippy::unit_cmp)]
#[actix_rt::test] #[actix_rt::test]
async fn spawn_local() { async fn spawn_local() {
// demonstrate that spawn -> R is strictly more capable than spawn -> () // demonstrate that spawn -> R is strictly more capable than spawn -> ()
assert_eq!(actix_rt::spawn(async { (|| {})() }).await.unwrap(), ()); assert_eq!(actix_rt::spawn(async {}).await.unwrap(), ());
assert_eq!(actix_rt::spawn(async { 1 }).await.unwrap(), 1); assert_eq!(actix_rt::spawn(async { 1 }).await.unwrap(), 1);
assert!(actix_rt::spawn(async { panic!("") }).await.is_err()); assert!(actix_rt::spawn(async { panic!("") }).await.is_err());