diff --git a/CHANGELOG.md b/CHANGELOG.md index ce0981c0..56dfedc9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ Bug fixes * Complex indexing/dotting chains now parse correctly, for example: `a[b][c[d]].e` * `map` and `filter` for arrays are marked `pure`. Warnings are added to the documentation of pure array methods that take `this` closures. * Syntax such as `foo.bar::baz` no longer panics, but returns a proper parse error. +* `x += y` where `x` and `y` are `char` now works correctly. Version 1.12.0 diff --git a/src/func/builtin.rs b/src/func/builtin.rs index e23f45ae..592297af 100644 --- a/src/func/builtin.rs +++ b/src/func/builtin.rs @@ -10,9 +10,9 @@ use crate::{ Dynamic, ExclusiveRange, ImmutableString, InclusiveRange, NativeCallContext, RhaiResult, SmartString, INT, }; +use std::any::TypeId; #[cfg(feature = "no_std")] use std::prelude::v1::*; -use std::{any::TypeId, fmt::Write}; #[cfg(not(feature = "no_float"))] use crate::FLOAT; @@ -753,7 +753,7 @@ pub fn get_builtin_op_assignment_fn(op: Token, x: &Dynamic, y: &Dynamic) -> Opti let x = &mut *args[0].write_lock::().unwrap(); let mut buf = SmartString::new_const(); - write!(&mut buf, "{y}").unwrap(); + buf.push(x.as_char().unwrap()); buf.push(y); Ok((*x = buf.into()).into())