diff options
author | Vincent Ambo <mail@tazj.in> | 2023-05-17T15·41+0300 |
---|---|---|
committer | tazjin <tazjin@tvl.su> | 2023-05-18T19·12+0000 |
commit | 64ee21ec86b3b8b0d35256b823f0e6c9670a9acc (patch) | |
tree | f3906038cd6acefaf080e37ecec071d2eb6cdb8b /tvix/cli | |
parent | ba4807e1de44a234fc9499dad0011440cde113fb (diff) |
chore(tvix/cli): remove unnecessary RefCell r/6160
This remained around from some previous time where this type was being cloned around directly, but it's not anymore. Change-Id: I2c61cf9cecb8e5d7d08644ed20642ee61357bc21 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8580 Tested-by: BuildkiteCI Reviewed-by: flokli <flokli@flokli.de>
Diffstat (limited to 'tvix/cli')
-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(), } } |