From 3cc5543cbc2dd82d956d37d3a10c021660abeeda Mon Sep 17 00:00:00 2001 From: Sergey Levitin Date: Thu, 2 Jan 2020 22:37:39 +0300 Subject: [PATCH] A little optimization for utils::escape::escape_html --- src/utils/escape.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/escape.rs b/src/utils/escape.rs index 67b2db2d..5bb38abf 100644 --- a/src/utils/escape.rs +++ b/src/utils/escape.rs @@ -5,7 +5,7 @@ use std::string::String; // Because they shoudn't be escaped by the spec: https://core.telegram.org/bots/api#html-style pub fn escape_html(raw: &str) -> String { let mut last = 0; - let mut out = String::new(); + let mut out = String::with_capacity(raw.len()); for (i, ch) in raw.bytes().enumerate() { match ch as char {