diff options
Diffstat (limited to 'tvix/cli/src')
-rw-r--r-- | tvix/cli/src/nix_compat.rs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/tvix/cli/src/nix_compat.rs b/tvix/cli/src/nix_compat.rs index 70bddb834674..4141e0a21759 100644 --- a/tvix/cli/src/nix_compat.rs +++ b/tvix/cli/src/nix_compat.rs @@ -5,7 +5,6 @@ //! by piggybacking off functionality that already exists in Nix and //! is still being implemented in Tvix. -use std::cell::RefCell; use std::collections::HashMap; use std::path::Path; use std::process::Command; @@ -25,7 +24,7 @@ pub struct NixCompatIO { // TODO(tazjin): This could be done better by having a thunk cache // for these calls on the eval side, but that is a little more // complex. - import_cache: RefCell<HashMap<PathBuf, PathBuf>>, + import_cache: HashMap<PathBuf, PathBuf>, } impl EvalIO for NixCompatIO { @@ -36,7 +35,7 @@ impl EvalIO for NixCompatIO { // Pass path imports through to `nix-store --add` fn import_path(&mut self, path: &Path) -> Result<PathBuf, ErrorKind> { let path = path.to_owned(); - if let Some(path) = self.import_cache.borrow().get(&path) { + if let Some(path) = self.import_cache.get(&path) { return Ok(path.to_path_buf()); } @@ -45,9 +44,8 @@ impl EvalIO for NixCompatIO { path: Some(path.to_path_buf()), })?; - self.import_cache - .borrow_mut() - .insert(path, store_path.clone()); + self.import_cache.insert(path, store_path.clone()); + Ok(store_path) } @@ -83,7 +81,7 @@ impl NixCompatIO { pub fn new() -> Self { NixCompatIO { underlying: StdIO, - import_cache: RefCell::new(HashMap::new()), + import_cache: HashMap::new(), } } |