diff options
Diffstat (limited to 'src/eval/builtins.rs')
-rw-r--r-- | src/eval/builtins.rs | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/eval/builtins.rs b/src/eval/builtins.rs index c91f7ba..e1fa10b 100644 --- a/src/eval/builtins.rs +++ b/src/eval/builtins.rs | |||
@@ -50,9 +50,7 @@ builtins! { | |||
50 | fn print(ctx: &mut Context, args: &[ast::Expr]) -> Result { | 50 | fn print(ctx: &mut Context, args: &[ast::Expr]) -> Result { |
51 | for arg in args { | 51 | for arg in args { |
52 | let val = ctx.eval_expr(arg)?; | 52 | let val = ctx.eval_expr(arg)?; |
53 | let mut default_stream = Box::new(std::io::stdout()) as Box<dyn std::io::Write>; | 53 | write!(ctx.output_stream, "{val}").unwrap(); |
54 | let stream = ctx.output_stream.as_mut().unwrap_or(&mut default_stream); | ||
55 | write!(stream, "{val}").unwrap(); | ||
56 | } | 54 | } |
57 | Ok(Value::Unit) | 55 | Ok(Value::Unit) |
58 | } | 56 | } |