diff --git a/src/entity/gateway/inmemory.rs b/src/entity/gateway/inmemory.rs index cedeaf6..12f9f8f 100644 --- a/src/entity/gateway/inmemory.rs +++ b/src/entity/gateway/inmemory.rs @@ -168,7 +168,8 @@ impl EntityGateway for InMemoryGateway { async fn get_characters_by_user(&self, user: &UserAccountEntity) -> Result<[Option; 4], GatewayError> { let characters = self.characters.lock().unwrap(); - let mut chars = [None; 4]; + const NONE: Option = None; + let mut chars = [NONE; 4]; characters .iter() .filter(|(_, c)| c.user_id == user.id) diff --git a/src/entity/gateway/postgres/postgres.rs b/src/entity/gateway/postgres/postgres.rs index 45aee91..4d7a36e 100644 --- a/src/entity/gateway/postgres/postgres.rs +++ b/src/entity/gateway/postgres/postgres.rs @@ -229,7 +229,8 @@ impl EntityGateway for PostgresGateway { let mut stream = sqlx::query_as::<_, PgCharacter>("select * from player_character where user_account = $1 and slot < 4 order by slot") .bind(user.id.0) .fetch(&self.pool); - let mut result = [None; 4]; + const NONE: Option = None; + let mut result = [NONE; 4]; while let Some(character) = stream.try_next().await? { let index = character.slot as usize; result[index] = Some(character.into()) diff --git a/src/lib.rs b/src/lib.rs index abd1d14..0927759 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,7 +1,7 @@ #![allow(incomplete_features)] #![feature(const_generics)] #![feature(maybe_uninit_extra)] -#![feature(const_in_array_repeat_expressions)] +#![feature(inline_const)] #![feature(drain_filter)] #![feature(or_patterns)]