summaryrefslogtreecommitdiff
path: root/learn_1/src
diff options
context:
space:
mode:
Diffstat (limited to 'learn_1/src')
-rw-r--r--learn_1/src/main.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/learn_1/src/main.rs b/learn_1/src/main.rs
index 80d8985..0d8181f 100644
--- a/learn_1/src/main.rs
+++ b/learn_1/src/main.rs
@@ -15,7 +15,7 @@ impl Inventory {
// `contains` returns true if `item` is in `self.items`.
pub fn contains(&self, item: &str) -> bool {
- self.items.contains(&String::from(item))
+ self.items.iter().any(|x| x == item)
}
// `remove` removes `item` from `self.items` if present.
@@ -41,8 +41,7 @@ mod tests {
#[test]
fn test_new() {
let inventory = Inventory::new();
- let _ = inventory.items;
- assert_eq!(true, true);
+ assert_eq!(inventory.items.len(), 0 as usize);
}
#[test]