irc-proto: Misc refactoring

This commit is contained in:
Hyeon Kim 2021-11-15 04:20:49 +09:00
parent b0c5f1fe90
commit 467efb9eba
No known key found for this signature in database
GPG key ID: 0F85F46EE242057F

View file

@ -290,19 +290,20 @@ fn unescape_tag_value(value: &str) -> String {
let mut unescaped = String::with_capacity(value.len());
let mut iter = value.chars();
while let Some(c) = iter.next() {
if c == '\\' {
let r = if c == '\\' {
match iter.next() {
Some(':') => unescaped.push(';'),
Some('s') => unescaped.push(' '),
Some('\\') => unescaped.push('\\'),
Some('r') => unescaped.push('\r'),
Some('n') => unescaped.push('\n'),
Some(c) => unescaped.push(c),
Some(':') => ';',
Some('s') => ' ',
Some('\\') => '\\',
Some('r') => '\r',
Some('n') => '\n',
Some(c) => c,
None => break,
}
} else {
unescaped.push(c);
}
c
};
unescaped.push(r);
}
unescaped
}