This is not a critical issue as Rust will move the string to a new place when the old one does not have enough space to contain the whole string, but if the crate already does some memory pre-allocation it should probably allocate enough for multi-byte separators. (e.g. an emoji)
The issue can be observed by adding a println!("Allocated {}", result.capacity()); on line 12 of src/display.rs and then also printing the len() of the string that is returned by separate_by_policy
This is not a critical issue as Rust will move the string to a new place when the old one does not have enough space to contain the whole string, but if the crate already does some memory pre-allocation it should probably allocate enough for multi-byte separators. (e.g. an emoji)
The issue can be observed by adding a
println!("Allocated {}", result.capacity());on line 12 ofsrc/display.rsand then also printing thelen()of the string that is returned byseparate_by_policy