From 9aa5d056657628f14677027a40476cf3ba963e4c Mon Sep 17 00:00:00 2001 From: Daniel Falbel Date: Wed, 27 Nov 2024 10:52:26 -0300 Subject: [PATCH] Remove possibly problematic `impl Into`. --- crates/harp/src/environment.rs | 4 ++-- crates/harp/src/utils.rs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/harp/src/environment.rs b/crates/harp/src/environment.rs index 9d296a774..0e6a907de 100644 --- a/crates/harp/src/environment.rs +++ b/crates/harp/src/environment.rs @@ -91,13 +91,13 @@ impl Environment { std::iter::successors(Some(self.clone()), |p| p.parent()) } - pub fn bind(&self, name: RSymbol, value: impl Into) { + pub fn bind(&self, name: RSymbol, value: SEXP) { unsafe { Rf_defineVar(name.sexp, value.into(), self.inner.sexp); } } - pub fn force_bind(&self, name: RSymbol, value: impl Into) { + pub fn force_bind(&self, name: RSymbol, value: SEXP) { let locked = self.is_locked_binding(name); if locked { self.unlock_binding(name); diff --git a/crates/harp/src/utils.rs b/crates/harp/src/utils.rs index 141cf0a9e..04cd88987 100644 --- a/crates/harp/src/utils.rs +++ b/crates/harp/src/utils.rs @@ -674,7 +674,7 @@ pub fn save_rds(x: SEXP, path: &str) { let env = Environment::new(harp::parse_eval_base("new.env()").unwrap()); env.bind("x".into(), x); - env.bind("path".into(), path); + env.bind("path".into(), path.sexp); let res = harp::parse_eval0("base::saveRDS(x, path)", env); @@ -702,8 +702,8 @@ pub fn push_rds(x: SEXP, path: &str, context: &str) { let env = Environment::new(harp::parse_eval_base("new.env()").unwrap()); env.bind("x".into(), x); - env.bind("path".into(), path); - env.bind("context".into(), context); + env.bind("path".into(), path.sexp); + env.bind("context".into(), context.sexp); let res = harp::parse_eval0(".ps.internal(push_rds(x, path, context))", env);