diff --git a/src/guard.rs b/src/guard.rs index 844d2ea..bd34d29 100644 --- a/src/guard.rs +++ b/src/guard.rs @@ -17,7 +17,6 @@ use std::ops::Deref; use crate::instance::InstanceVersion; use crate::state::State; -use crate::synchronizer::SynchronizerError; /// An RAII implementation of a “scoped read lock” of a `State` pub(crate) struct ReadGuard<'a> { @@ -27,12 +26,9 @@ pub(crate) struct ReadGuard<'a> { impl<'a> ReadGuard<'a> { /// Creates new `ReadGuard` with specified parameters - pub(crate) fn new( - state: &'a mut State, - version: InstanceVersion, - ) -> Result { + pub(crate) fn new(state: &'a mut State, version: InstanceVersion) -> Self { state.rlock(version); - Ok(ReadGuard { version, state }) + ReadGuard { version, state } } } diff --git a/src/synchronizer.rs b/src/synchronizer.rs index 3b50b76..179fba9 100644 --- a/src/synchronizer.rs +++ b/src/synchronizer.rs @@ -231,7 +231,7 @@ where let version = state.version()?; // create and lock state guard for reading - let guard = ReadGuard::new(state, version)?; + let guard = ReadGuard::new(state, version); // fetch data for current version from mapped memory let (data, switched) = self.data_container.data(version)?;