Commit 52edc532 authored by Rahix's avatar Rahix 🦀
Browse files

More readable slice coercion syntax

parent fd64e440
......@@ -8,7 +8,7 @@ pub fn create_stationary_obstacles(world: &mut legion::World, level: &svg_loader
let spawn_locations_barriers = level
.spawnpoints
.get("stationary_obstacle_type_1")
.map_or(&[][..], |x| &x[..]);
.map_or([].as_ref(), |x| x.as_ref());
for obs in spawn_locations_barriers.choose_multiple(&mut rand::thread_rng(), 3) {
let orientation = *[true, false].choose(&mut rand::thread_rng()).unwrap();
let new_obs = components::ObstacleBarrier::new(orientation);
......@@ -22,7 +22,7 @@ pub fn create_stationary_obstacles(world: &mut legion::World, level: &svg_loader
let spawn_locations_insanity = level
.spawnpoints
.get("stationary_obstacle_type_2")
.map_or(&[][..], |x| &x[..]);
.map_or([].as_ref(), |x| x.as_ref());
for obs in spawn_locations_insanity.choose_multiple(&mut rand::thread_rng(), 1) {
let new_obs = components::ObstacleInsanity::new();
world.push((
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment