From 71d1fd7eaf4eb69e5511c9c40fc5437756726971 Mon Sep 17 00:00:00 2001 From: Zack Date: Sat, 4 Mar 2023 16:11:29 +0300 Subject: [PATCH 1/2] Unwrap .spawn() to support updated tokio task builder API --- src/internal/tokio.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/internal/tokio.rs b/src/internal/tokio.rs index 5c204a27bfb..216812984ed 100644 --- a/src/internal/tokio.rs +++ b/src/internal/tokio.rs @@ -6,7 +6,7 @@ where F: Future + Send + 'static, T: Send + 'static, { - tokio::task::Builder::new().name(&*format!("serenity::{}", name)).spawn(future) + tokio::task::Builder::new().name(&*format!("serenity::{}", name)).spawn(future).unwrap() } #[cfg(not(all(tokio_unstable, feature = "tokio_task_builder")))] From 98f0853d410e123c51bf7f9bbde8f0f42c17bec3 Mon Sep 17 00:00:00 2001 From: Zack Date: Sun, 5 Mar 2023 15:02:13 +0300 Subject: [PATCH 2/2] Replace .unwrap() with .expect() --- src/internal/tokio.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/internal/tokio.rs b/src/internal/tokio.rs index 216812984ed..027c80079c5 100644 --- a/src/internal/tokio.rs +++ b/src/internal/tokio.rs @@ -6,7 +6,10 @@ where F: Future + Send + 'static, T: Send + 'static, { - tokio::task::Builder::new().name(&*format!("serenity::{}", name)).spawn(future).unwrap() + tokio::task::Builder::new() + .name(&*format!("serenity::{}", name)) + .spawn(future) + .expect("called outside tokio runtime") } #[cfg(not(all(tokio_unstable, feature = "tokio_task_builder")))]