revert(tvix): don't use Rc::clone explicitly
This reverts commit d9565a4d0a
.
Reason for revert: this was intentional - putting Rc::clone instead of
.clone is a common Rust idiom, and makes it explicit that we're cloning
a shared reference, not an underlying resource
Change-Id: I41a5f323ee35d7025dc7bb02f7d5d05d0051798d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10995
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
This commit is contained in:
parent
771200df7c
commit
d74c68025b
4 changed files with 9 additions and 9 deletions
|
@ -130,8 +130,8 @@ fn interpret(code: &str, path: Option<PathBuf>, args: &Args, explain: bool) -> b
|
||||||
);
|
);
|
||||||
eval.strict = args.strict;
|
eval.strict = args.strict;
|
||||||
eval.builtins.extend(impure_builtins());
|
eval.builtins.extend(impure_builtins());
|
||||||
add_derivation_builtins(&mut eval, tvix_store_io.clone());
|
add_derivation_builtins(&mut eval, Rc::clone(&tvix_store_io));
|
||||||
add_fetcher_builtins(&mut eval, tvix_store_io.clone());
|
add_fetcher_builtins(&mut eval, Rc::clone(&tvix_store_io));
|
||||||
add_import_builtins(&mut eval, tvix_store_io);
|
add_import_builtins(&mut eval, tvix_store_io);
|
||||||
configure_nix_path(&mut eval, &args.nix_search_path);
|
configure_nix_path(&mut eval, &args.nix_search_path);
|
||||||
|
|
||||||
|
|
|
@ -46,8 +46,8 @@ fn interpret(code: &str) {
|
||||||
);
|
);
|
||||||
|
|
||||||
eval.builtins.extend(impure_builtins());
|
eval.builtins.extend(impure_builtins());
|
||||||
add_derivation_builtins(&mut eval, tvix_store_io.clone());
|
add_derivation_builtins(&mut eval, Rc::clone(&tvix_store_io));
|
||||||
add_fetcher_builtins(&mut eval, tvix_store_io.clone());
|
add_fetcher_builtins(&mut eval, Rc::clone(&tvix_store_io));
|
||||||
add_import_builtins(&mut eval, tvix_store_io);
|
add_import_builtins(&mut eval, tvix_store_io);
|
||||||
configure_nix_path(
|
configure_nix_path(
|
||||||
&mut eval,
|
&mut eval,
|
||||||
|
|
|
@ -129,7 +129,7 @@ mod import_builtins {
|
||||||
path: Value,
|
path: Value,
|
||||||
) -> Result<Value, ErrorKind> {
|
) -> Result<Value, ErrorKind> {
|
||||||
let p = path.to_path()?;
|
let p = path.to_path()?;
|
||||||
let root_node = filtered_ingest(state.clone(), co, &p, Some(&filter)).await?;
|
let root_node = filtered_ingest(Rc::clone(&state), co, &p, Some(&filter)).await?;
|
||||||
let name = tvix_store::import::path_to_name(&p)?;
|
let name = tvix_store::import::path_to_name(&p)?;
|
||||||
|
|
||||||
Ok(state
|
Ok(state
|
||||||
|
|
|
@ -20,7 +20,7 @@ pub use derivation_error::Error as DerivationError;
|
||||||
/// `known_paths`.
|
/// `known_paths`.
|
||||||
pub fn add_derivation_builtins<IO>(eval: &mut tvix_eval::Evaluation<IO>, io: Rc<TvixStoreIO>) {
|
pub fn add_derivation_builtins<IO>(eval: &mut tvix_eval::Evaluation<IO>, io: Rc<TvixStoreIO>) {
|
||||||
eval.builtins
|
eval.builtins
|
||||||
.extend(derivation::derivation_builtins::builtins(io));
|
.extend(derivation::derivation_builtins::builtins(Rc::clone(&io)));
|
||||||
|
|
||||||
// Add the actual `builtins.derivation` from compiled Nix code
|
// Add the actual `builtins.derivation` from compiled Nix code
|
||||||
eval.src_builtins
|
eval.src_builtins
|
||||||
|
@ -34,7 +34,7 @@ pub fn add_derivation_builtins<IO>(eval: &mut tvix_eval::Evaluation<IO>, io: Rc<
|
||||||
/// * `fetchGit`
|
/// * `fetchGit`
|
||||||
pub fn add_fetcher_builtins<IO>(eval: &mut tvix_eval::Evaluation<IO>, io: Rc<TvixStoreIO>) {
|
pub fn add_fetcher_builtins<IO>(eval: &mut tvix_eval::Evaluation<IO>, io: Rc<TvixStoreIO>) {
|
||||||
eval.builtins
|
eval.builtins
|
||||||
.extend(fetchers::fetcher_builtins::builtins(io));
|
.extend(fetchers::fetcher_builtins::builtins(Rc::clone(&io)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Adds import-related builtins to the passed [tvix_eval::Evaluation].
|
/// Adds import-related builtins to the passed [tvix_eval::Evaluation].
|
||||||
|
@ -82,8 +82,8 @@ mod tests {
|
||||||
|
|
||||||
let mut eval = tvix_eval::Evaluation::new(io.clone() as Rc<dyn EvalIO>, false);
|
let mut eval = tvix_eval::Evaluation::new(io.clone() as Rc<dyn EvalIO>, false);
|
||||||
|
|
||||||
add_derivation_builtins(&mut eval, io.clone());
|
add_derivation_builtins(&mut eval, Rc::clone(&io));
|
||||||
add_fetcher_builtins(&mut eval, io.clone());
|
add_fetcher_builtins(&mut eval, Rc::clone(&io));
|
||||||
add_import_builtins(&mut eval, io);
|
add_import_builtins(&mut eval, io);
|
||||||
|
|
||||||
// run the evaluation itself.
|
// run the evaluation itself.
|
||||||
|
|
Loading…
Reference in a new issue