diff options
author | Florian Klink <flokli@flokli.de> | 2024-02-20T10·35+0700 |
---|---|---|
committer | flokli <flokli@flokli.de> | 2024-02-20T12·24+0000 |
commit | d9565a4d0af3bffd735a77aa6f1fd0ec0e03b14a (patch) | |
tree | d5202b769dc21670957b23abc600c7e95835247b /tvix | |
parent | d0d1027a853882f8bb44ac26c865f04bfa42ed70 (diff) |
refactor(tvix): don't use Rc::clone explicitly r/7576
All these functions have an Rc of Rc<TvixStoreIO> or Rc<dyn StoreIO>, so we can call io.clone() directly. Change-Id: I96a5bcb9af4aca93892cb72bcfaf14540da52381 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10989 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
Diffstat (limited to 'tvix')
-rw-r--r-- | tvix/cli/src/main.rs | 2 | ||||
-rw-r--r-- | tvix/glue/benches/eval.rs | 2 | ||||
-rw-r--r-- | tvix/glue/src/builtins/mod.rs | 6 |
3 files changed, 5 insertions, 5 deletions
diff --git a/tvix/cli/src/main.rs b/tvix/cli/src/main.rs index d765fa98392c..b7394a984b3f 100644 --- a/tvix/cli/src/main.rs +++ b/tvix/cli/src/main.rs @@ -129,7 +129,7 @@ fn interpret(code: &str, path: Option<PathBuf>, args: &Args, explain: bool) -> b ); eval.strict = args.strict; eval.builtins.extend(impure_builtins()); - add_derivation_builtins(&mut eval, Rc::clone(&tvix_store_io)); + add_derivation_builtins(&mut eval, tvix_store_io.clone()); add_fetcher_builtins(&mut eval, tvix_store_io); configure_nix_path(&mut eval, &args.nix_search_path); diff --git a/tvix/glue/benches/eval.rs b/tvix/glue/benches/eval.rs index 11435707aca6..2bbe10fe93b4 100644 --- a/tvix/glue/benches/eval.rs +++ b/tvix/glue/benches/eval.rs @@ -46,7 +46,7 @@ fn interpret(code: &str) { ); eval.builtins.extend(impure_builtins()); - add_derivation_builtins(&mut eval, Rc::clone(&tvix_store_io)); + add_derivation_builtins(&mut eval, tvix_store_io.clone()); add_fetcher_builtins(&mut eval, tvix_store_io); configure_nix_path( &mut eval, diff --git a/tvix/glue/src/builtins/mod.rs b/tvix/glue/src/builtins/mod.rs index 4a59ec9ea6e5..8fc3e0ada7bc 100644 --- a/tvix/glue/src/builtins/mod.rs +++ b/tvix/glue/src/builtins/mod.rs @@ -18,7 +18,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(Rc::clone(&io))); + .extend(derivation::derivation_builtins::builtins(io)); // Add the actual `builtins.derivation` from compiled Nix code eval.src_builtins @@ -32,7 +32,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(Rc::clone(&io))); + .extend(fetchers::fetcher_builtins::builtins(io)); } #[cfg(test)] @@ -68,7 +68,7 @@ mod tests { let mut eval = tvix_eval::Evaluation::new(io.clone() as Rc<dyn EvalIO>, false); - add_derivation_builtins(&mut eval, Rc::clone(&io)); + add_derivation_builtins(&mut eval, io.clone()); add_fetcher_builtins(&mut eval, io); // run the evaluation itself. |