I keep getting the error "Use of moved value".
let mut s = "s".to_string();
s = s + &s;
Adding a solution to Chris Morgan's answer:
let s = "s";
let mut double_s = s.to_owned(); // faster, better than to_string()
double_s = double_s + s;
You could also use
double_s.push_str(s);
instead of the last line.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With