diff options
| author | Brad Clawsie <brad@b7j0c.org> | 2026-11-12 11:49:07 -0600 |
|---|---|---|
| committer | Brad Clawsie <brad@b7j0c.org> | 2026-11-12 11:49:07 -0600 |
| commit | 5a39e24beb4b90fe17ce7b698ad353eb16d974df (patch) | |
| tree | d3447cf709fd8f22aae82211d8cf9ecf6993bf76 /learn_1/src/main.rs | |
| parent | ccb7ac0f53a707d0b085174dee00c0b3acd5ef00 (diff) | |
fix: corrections_2
Diffstat (limited to 'learn_1/src/main.rs')
| -rw-r--r-- | learn_1/src/main.rs | 5 |
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] |
