Use &mut.

This commit is contained in:
Stephen Chung 2020-08-19 12:53:33 +08:00
parent c55b0d7883
commit 980aba77a9

View File

@ -22,12 +22,12 @@ macro_rules! gen_concat_functions {
use super::super::*;
#[export_fn]
pub fn append_func(x: ImmutableString, y: $arg_type) -> String {
pub fn append_func(x: &mut ImmutableString, y: $arg_type) -> String {
super::super::add_append(x, y)
}
#[export_fn]
pub fn prepend_func(x: $arg_type, y: ImmutableString) -> String {
pub fn prepend_func(x: &mut $arg_type, y: ImmutableString) -> String {
super::super::add_prepend(x, y)
}
}
@ -120,10 +120,10 @@ def_package!(crate:MoreStringPackage:"Additional string utilities, including str
);
});
fn add_prepend<T: Display>(x: T, y: ImmutableString) -> String {
fn add_prepend<T: Display>(x: &mut T, y: ImmutableString) -> String {
format!("{}{}", x, y)
}
fn add_append<T: Display>(x: ImmutableString, y: T) -> String {
fn add_append<T: Display>(x: &mut ImmutableString, y: T) -> String {
format!("{}{}", x, y)
}