melib/imap: replace splice with truncate
Tests / Test on ${{ matrix.build }} (linux-amd64, ubuntu-latest, stable, x86_64-unknown-linux-gnu) (push) Successful in 10m56s Details

splice() was calling memmove, it is a really inefficient way of
truncating a string.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
pull/314/head
Manos Pitsidianakis 2023-11-09 09:56:21 +02:00
parent 606f487fc5
commit 8a21be2177
Signed by: Manos Pitsidianakis
GPG Key ID: 7729C7707F7E09D0
1 changed files with 1 additions and 1 deletions

View File

@ -503,7 +503,7 @@ impl ImapStream {
&& ret[last_line_idx..].starts_with(termination_string)
{
if !keep_termination_string {
ret.splice(last_line_idx.., std::iter::empty::<u8>());
ret.truncate(last_line_idx);
}
break;
} else if termination_string.is_empty() {