From a7fc872f1c05bf08c892c7e74a1b1834c9a2dcd6 Mon Sep 17 00:00:00 2001 From: Joshua Barretto Date: Thu, 25 Jul 2019 15:02:05 +0100 Subject: [PATCH] Added Default impl for Inventory --- common/src/comp/inventory/mod.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/common/src/comp/inventory/mod.rs b/common/src/comp/inventory/mod.rs index 9406f50a50..3f3e0ba9f1 100644 --- a/common/src/comp/inventory/mod.rs +++ b/common/src/comp/inventory/mod.rs @@ -13,12 +13,6 @@ pub struct Inventory { } impl Inventory { - pub fn new() -> Inventory { - Inventory { - slots: vec![None; 24], - } - } - // Get info about an item slot pub fn get(&self, cell: usize) -> Option { self.slots.get(cell).cloned().flatten() @@ -36,6 +30,14 @@ impl Inventory { } } +impl Default for Inventory { + fn default() -> Inventory { + Inventory { + slots: vec![None; 24], + } + } +} + impl Component for Inventory { type Storage = HashMapStorage; }