chore(tvix/cli): remove unnecessary RefCell

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>
This commit is contained in:
Vincent Ambo 2023-05-17 18:41:52 +03:00 committed by tazjin
parent ba4807e1de
commit 64ee21ec86

View file

@ -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(),
}
}