mirror of
https://github.com/soywod/himalaya.git
synced 2024-07-05 17:15:12 +00:00
use char when replacing a single character
Reasons: - More idiomatic use of string. Considering that they are constants, I don't anticipate any performance gains related to heap-allocation. Signed-off-by: Perma Alesheikh <me@prma.dev>
This commit is contained in:
parent
f7a7937cb1
commit
0ff940871b
|
@ -12,7 +12,7 @@ pub struct MessageRawBodyArg {
|
||||||
|
|
||||||
impl MessageRawBodyArg {
|
impl MessageRawBodyArg {
|
||||||
pub fn raw(self) -> String {
|
pub fn raw(self) -> String {
|
||||||
self.raw.join(" ").replace("\r", "").replace("\n", "\r\n")
|
self.raw.join(" ").replace('\r', "").replace('\n', "\r\n")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ pub struct HeaderRawArgs {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn raw_header_parser(raw_header: &str) -> Result<(String, String), String> {
|
pub fn raw_header_parser(raw_header: &str) -> Result<(String, String), String> {
|
||||||
if let Some((key, val)) = raw_header.split_once(":") {
|
if let Some((key, val)) = raw_header.split_once(':') {
|
||||||
Ok((key.trim().to_owned(), val.trim().to_owned()))
|
Ok((key.trim().to_owned(), val.trim().to_owned()))
|
||||||
} else {
|
} else {
|
||||||
Err(format!("cannot parse raw header {raw_header:?}"))
|
Err(format!("cannot parse raw header {raw_header:?}"))
|
||||||
|
|
|
@ -15,6 +15,6 @@ pub struct MessageRawArg {
|
||||||
|
|
||||||
impl MessageRawArg {
|
impl MessageRawArg {
|
||||||
pub fn raw(self) -> String {
|
pub fn raw(self) -> String {
|
||||||
self.raw.join(" ").replace("\r", "").replace("\n", "\r\n")
|
self.raw.join(" ").replace('\r', "").replace('\n', "\r\n")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ pub struct TemplateRawBodyArg {
|
||||||
|
|
||||||
impl TemplateRawBodyArg {
|
impl TemplateRawBodyArg {
|
||||||
pub fn raw(self) -> String {
|
pub fn raw(self) -> String {
|
||||||
self.raw.join(" ").replace("\r", "")
|
self.raw.join(" ").replace('\r', "")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,6 @@ pub struct TemplateRawArg {
|
||||||
|
|
||||||
impl TemplateRawArg {
|
impl TemplateRawArg {
|
||||||
pub fn raw(self) -> String {
|
pub fn raw(self) -> String {
|
||||||
self.raw.join(" ").replace("\r", "")
|
self.raw.join(" ").replace('\r', "")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue