aboutsummaryrefslogtreecommitdiff
path: root/azalea
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2023-12-05 10:55:20 -0600
committermat <git@matdoes.dev>2023-12-05 10:55:20 -0600
commitea3e8600126a58f5666d50fbf70dff8209d8979f (patch)
tree314681ced884d549f5c3d530ee2f8f1cd6a47132 /azalea
parent421d8ce2c837e3140d8f866e63032c277b31a413 (diff)
downloadazalea-drasl-ea3e8600126a58f5666d50fbf70dff8209d8979f.tar.xz
make start return never
Diffstat (limited to 'azalea')
-rw-r--r--azalea/src/lib.rs3
-rw-r--r--azalea/src/swarm/mod.rs10
2 files changed, 7 insertions, 6 deletions
diff --git a/azalea/src/lib.rs b/azalea/src/lib.rs
index 45cf7779..fd2cb83a 100644
--- a/azalea/src/lib.rs
+++ b/azalea/src/lib.rs
@@ -3,6 +3,7 @@
#![feature(type_changing_struct_update)]
#![feature(lazy_cell)]
#![feature(let_chains)]
+#![feature(never_type)]
pub mod accept_resource_packs;
pub mod auto_respawn;
@@ -180,7 +181,7 @@ where
mut self,
account: Account,
address: impl TryInto<ServerAddress>,
- ) -> Result<(), StartError> {
+ ) -> Result<!, StartError> {
self.swarm.accounts = vec![account];
if self.swarm.states.is_empty() {
self.swarm.states = vec![S::default()];
diff --git a/azalea/src/swarm/mod.rs b/azalea/src/swarm/mod.rs
index d485eb30..1c89cdbe 100644
--- a/azalea/src/swarm/mod.rs
+++ b/azalea/src/swarm/mod.rs
@@ -292,7 +292,7 @@ where
/// that implements `TryInto<ServerAddress>`.
///
/// [`ServerAddress`]: azalea_protocol::ServerAddress
- pub async fn start(self, address: impl TryInto<ServerAddress>) -> Result<(), StartError> {
+ pub async fn start(self, address: impl TryInto<ServerAddress>) -> Result<!, StartError> {
assert_eq!(
self.accounts.len(),
self.states.len(),
@@ -351,7 +351,7 @@ where
let accounts = self.accounts.clone();
let states = self.states.clone();
- let join_task = tokio::spawn(async move {
+ tokio::spawn(async move {
if let Some(join_delay) = join_delay {
// if there's a join delay, then join one by one
for (account, state) in accounts.iter().zip(states) {
@@ -412,9 +412,9 @@ where
}
}
- join_task.abort();
-
- Ok(())
+ unreachable!(
+ "bots_rx.recv() should never be None because the bots_tx channel is never closed"
+ );
}
}