diff --git a/src/rust/src/utils/mod.rs b/src/rust/src/utils/mod.rs index 185c2e13f..47b4558ad 100644 --- a/src/rust/src/utils/mod.rs +++ b/src/rust/src/utils/mod.rs @@ -638,7 +638,7 @@ fn internal_rust_wrap_e(robj: Robj, str_to_lit: bool) -> RResult { match robj.rtype() { ExternalPtr if robj.inherits("Expr") => Ok(robj), ExternalPtr if robj.inherits("WhenThen") | robj.inherits("WhenThenThen") => { - unpack(R!("polars:::({{robj}}$otherwise(pl$lit(NULL)))")) + unpack(R!("polars:::result({{robj}}$otherwise(pl$lit(NULL)))")) } ExternalPtr if robj.inherits("When") => { rerr().plain("Cannot use a When-statement as Expr without a $then()")