about summary refs log tree commit diff
path: root/tvix/glue/src/builtins
diff options
context:
space:
mode:
authoraspen <root@gws.fyi>2024-02-20T16·04+0000
committeraspen <root@gws.fyi>2024-02-21T18·36+0000
commitd74c68025b5d1ffea3cd4f9731ee53b6ca2c6271 (patch)
tree1e317a107891b3b866bda3c72582e49c1d166369 /tvix/glue/src/builtins
parent771200df7c311fc8b87a0a65a02e22a11d80cd66 (diff)
revert(tvix): don't use Rc::clone explicitly r/7588
This reverts commit d9565a4d0af3bffd735a77aa6f1fd0ec0e03b14a.

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>
Diffstat (limited to 'tvix/glue/src/builtins')
-rw-r--r--tvix/glue/src/builtins/import.rs2
-rw-r--r--tvix/glue/src/builtins/mod.rs8
2 files changed, 5 insertions, 5 deletions
diff --git a/tvix/glue/src/builtins/import.rs b/tvix/glue/src/builtins/import.rs
index 536585102d45..7e21942e9196 100644
--- a/tvix/glue/src/builtins/import.rs
+++ b/tvix/glue/src/builtins/import.rs
@@ -129,7 +129,7 @@ mod import_builtins {
         path: Value,
     ) -> Result<Value, ErrorKind> {
         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)?;
 
         Ok(state
diff --git a/tvix/glue/src/builtins/mod.rs b/tvix/glue/src/builtins/mod.rs
index 78e5fe87ec4c..a62ba192871f 100644
--- a/tvix/glue/src/builtins/mod.rs
+++ b/tvix/glue/src/builtins/mod.rs
@@ -20,7 +20,7 @@ pub use derivation_error::Error as DerivationError;
 /// `known_paths`.
 pub fn add_derivation_builtins<IO>(eval: &mut tvix_eval::Evaluation<IO>, io: Rc<TvixStoreIO>) {
     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
     eval.src_builtins
@@ -34,7 +34,7 @@ pub fn add_derivation_builtins<IO>(eval: &mut tvix_eval::Evaluation<IO>, io: Rc<
 /// * `fetchGit`
 pub fn add_fetcher_builtins<IO>(eval: &mut tvix_eval::Evaluation<IO>, io: Rc<TvixStoreIO>) {
     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].
@@ -82,8 +82,8 @@ mod tests {
 
         let mut eval = tvix_eval::Evaluation::new(io.clone() as Rc<dyn EvalIO>, false);
 
-        add_derivation_builtins(&mut eval, io.clone());
-        add_fetcher_builtins(&mut eval, io.clone());
+        add_derivation_builtins(&mut eval, Rc::clone(&io));
+        add_fetcher_builtins(&mut eval, Rc::clone(&io));
         add_import_builtins(&mut eval, io);
 
         // run the evaluation itself.