diff --git a/kiln-core/src/map_file.rs b/kiln-core/src/map_file.rs index 8cc06c0..cacb52f 100644 --- a/kiln-core/src/map_file.rs +++ b/kiln-core/src/map_file.rs @@ -583,9 +583,9 @@ impl From<&Board> for MapFile { for x in 0..board.width { let (glyph, arch) = board.get(x, y); let key = (*glyph, *arch); - if !cell_to_key.contains_key(&key) { + if let std::collections::hash_map::Entry::Vacant(e) = cell_to_key.entry(key) { if key == canonical_empty { - cell_to_key.insert(key, ' '); + e.insert(' '); palette.insert( " ".to_string(), PaletteEntry { @@ -599,7 +599,7 @@ impl From<&Board> for MapFile { let ch = *pool_iter .next() .expect("board has more than 92 unique non-canonical cell types"); - cell_to_key.insert(key, ch); + e.insert(ch); palette.insert( ch.to_string(), PaletteEntry { diff --git a/kiln-core/src/script.rs b/kiln-core/src/script.rs index 743a3f4..5ff7b96 100644 --- a/kiln-core/src/script.rs +++ b/kiln-core/src/script.rs @@ -430,7 +430,7 @@ fn register_read_api(engine: &mut Engine, board: &BoardRef, board_queue: &BoardQ let b = board.clone(); engine.register_fn("has_tag", move |ctx: NativeCallContext, tag: ImmutableString| { let src = source_of(&ctx); - b.borrow().objects.get(&src).map_or(false, |o| o.tags.contains(tag.as_str())) + b.borrow().objects.get(&src).is_some_and(|o| o.tags.contains(tag.as_str())) }); // get_tags() -> Array of strings: the calling object's current tag set. diff --git a/kiln-core/src/tests/actions.rs b/kiln-core/src/tests/actions.rs index 48201d7..539153f 100644 --- a/kiln-core/src/tests/actions.rs +++ b/kiln-core/src/tests/actions.rs @@ -2,7 +2,6 @@ use std::time::Duration; use crate::archetype::Archetype; use crate::board::tests::{crate_at, open_board, wall_at}; use crate::game::GameState; -use crate::script::Direction; use super::{scripted_object, log_texts}; #[test]