From 780fb979a0462feca19ba3bb6d0e3c1ccc7fe9dc Mon Sep 17 00:00:00 2001 From: FrankHB Date: Tue, 29 Sep 2020 18:01:06 +0800 Subject: [PATCH] Avoided the redundant allocation. Signed-off-by: FrankHB --- src/book/book.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/book/book.rs b/src/book/book.rs index 369c6a07..09b51888 100644 --- a/src/book/book.rs +++ b/src/book/book.rs @@ -265,7 +265,7 @@ fn load_chapter>( })?; if content.as_bytes().starts_with(b"\xef\xbb\xbf") { - content = content[3..].to_string() + content.replace_range(..3, ""); } let stripped = location