From 0daa72b116c68a17f1589cc4124e110188b49beb Mon Sep 17 00:00:00 2001 From: Claudia Meadows Date: Sat, 29 Jun 2024 15:07:39 -0700 Subject: [PATCH] Update call_spy_map.rs --- src/test_utils/spy/call_spy_map.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/test_utils/spy/call_spy_map.rs b/src/test_utils/spy/call_spy_map.rs index e860717..c19b25b 100644 --- a/src/test_utils/spy/call_spy_map.rs +++ b/src/test_utils/spy/call_spy_map.rs @@ -72,9 +72,9 @@ impl CallSpyMap { let guard = self.states.lock().unwrap_or_else(|e| e.into_inner()); - for (key, state) in guard.iter() { + for state in guard.iter() { if !state.results.is_empty() { - write!(&mut fail_pairs, "{}{:?} => {:?}", prefix, key, &state.results) + write!(&mut fail_pairs, "{}{:?} => {:?}", prefix, &state.key, &state.results) .unwrap(); prefix = ", "; } @@ -82,7 +82,7 @@ impl CallSpyMap { drop(guard); // don't poison - if !result.is_empty() { + if !fail_pairs.is_empty() { panic!( "Unexpected calls remaining for `{}`: {{{}}}", self.name, fail_pairs @@ -101,7 +101,7 @@ impl CallSpyMap { 'outer: for (key, value) in expected.iter() { for (k, v) in expected_map.iter_mut() { - if k == key { + if *k == key { v.push(value); continue 'outer; } @@ -136,8 +136,8 @@ impl CallSpyMap { 'outer: for state in states { for (key, expected) in expected_map { - if key == states.key { - if !state.args.iter().eq(expected) { + if key == state.key { + if !state.args.iter().eq(&expected) { return false; }