A bunch of fixes and improvements
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
@@ -41,7 +41,7 @@ pub mod tests {
|
||||
pub fn build() -> AbilityLibrary {
|
||||
let mut lib = AbilityLibrary::new(1);
|
||||
lib.add(
|
||||
&StringKey::new("test_ability"),
|
||||
&StringKey::new("test_ability".into()),
|
||||
Ability::new(&"test_ability".into(), &"test_ability".into(), Vec::new()),
|
||||
);
|
||||
// Drops borrow as mut
|
||||
|
||||
@@ -61,7 +61,7 @@ pub mod tests {
|
||||
let m = build_move();
|
||||
// Borrow as mut so we can insert
|
||||
let w = &mut lib;
|
||||
w.add(&StringKey::new("foo"), m);
|
||||
w.add(&StringKey::new("foo".into()), m);
|
||||
// Drops borrow as mut
|
||||
|
||||
lib
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use std::sync::Arc;
|
||||
use std::sync::{Arc, LazyLock};
|
||||
|
||||
use hashbrown::{HashMap, HashSet};
|
||||
|
||||
@@ -29,11 +29,11 @@ pub struct Species {
|
||||
}
|
||||
|
||||
/// A cached String Key to get the default form.
|
||||
static DEFAULT_KEY: conquer_once::OnceCell<StringKey> = conquer_once::OnceCell::uninit();
|
||||
static DEFAULT_KEY: LazyLock<StringKey> = LazyLock::new(|| StringKey::new("default"));
|
||||
|
||||
/// Gets the StringKey for "default". Initialises it if it does not exist.
|
||||
fn get_default_key() -> StringKey {
|
||||
DEFAULT_KEY.get_or_init(|| StringKey::new("default")).clone()
|
||||
DEFAULT_KEY.clone()
|
||||
}
|
||||
|
||||
impl Species {
|
||||
|
||||
Reference in New Issue
Block a user