I couldn't understand anything wrong with the following function.
fn percuss<'a>(a: &'a mut str, b: &str, val: usize) -> &'a mut str {
a.to_string().insert_str(val, b)
}
However, I get the following error:
error[E0308]: mismatched types
--> src/lib.rs:2:5
|
2 | a.to_string().insert_str(val, b)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&mut str`, found `()`
I do not or I am failing to see any reason for a.to_string().insert_str(val, b)
to return a ()
. Could someone shed some light what I am missing to notice/understand?