Skip to content

Commit

Permalink
fix: Simpler read
Browse files Browse the repository at this point in the history
  • Loading branch information
can-keklik committed Dec 16, 2024
1 parent 75e3689 commit 568c981
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lykiadb-server/src/value/environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,10 @@ impl EnvironmentFrame {
}

pub fn read(&self, key: &str, key_sym: &SymbolU32) -> Result<RV, HaltReason> {
if self.map.read().unwrap().contains_key(key_sym) {
let guard = self.map.read().unwrap();
if let Some(value) = guard.get(key_sym) {
// TODO(vck): Remove clone
return Ok(self.map.read().unwrap().get(key_sym).unwrap().clone());
return Ok(value.clone());
}
self.parent.as_ref().map_or(
Err(HaltReason::Error(
Expand Down

0 comments on commit 568c981

Please sign in to comment.