Skip to content

Commit

Permalink
Wrap stubs mutex in arc
Browse files Browse the repository at this point in the history
  • Loading branch information
orbwalk committed Feb 23, 2022
1 parent d4b9fe4 commit d2ebbf7
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions src/mock_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@ impl<T> MaybeFaux<T> {
}
}

#[derive(Debug, Default)]
#[derive(Clone, Debug, Default)]
#[doc(hidden)]
pub struct MockStore {
stubs: Mutex<HashMap<usize, Arc<Mutex<Vec<stub::Saved<'static>>>>>>,
stubs: Arc<Mutex<HashMap<usize, Arc<Mutex<Vec<stub::Saved<'static>>>>>>>,
}

impl MockStore {
fn new() -> Self {
MockStore {
stubs: Mutex::new(HashMap::new()),
stubs: Arc::new(Mutex::new(HashMap::new())),
}
}

Expand Down Expand Up @@ -115,12 +115,3 @@ impl MockStore {
Err(errors.join("\n\n"))
}
}

impl Clone for MockStore {
fn clone(&self) -> Self {
let stubs = self.stubs.lock().unwrap();
Self {
stubs: Mutex::new(stubs.clone()),
}
}
}

0 comments on commit d2ebbf7

Please sign in to comment.