mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 14:35:36 +01:00
format the code
This commit is contained in:
parent
67ca69c142
commit
95ebe2a764
1 changed files with 2 additions and 3 deletions
|
@ -109,9 +109,8 @@ pub fn code_inline(s: &str) -> String {
|
||||||
#[must_use = "This function returns a new string, rather than mutating the argument, so calling it \
|
#[must_use = "This function returns a new string, rather than mutating the argument, so calling it \
|
||||||
without using its output does nothing useful"]
|
without using its output does nothing useful"]
|
||||||
pub fn escape(s: &str) -> String {
|
pub fn escape(s: &str) -> String {
|
||||||
const CHARS: [char; 18] = [
|
const CHARS: [char; 18] =
|
||||||
'_', '*', '[', ']', '(', ')', '~', '`', '>', '#', '+', '-', '=', '|', '{', '}', '.', '!',
|
['_', '*', '[', ']', '(', ')', '~', '`', '>', '#', '+', '-', '=', '|', '{', '}', '.', '!'];
|
||||||
];
|
|
||||||
|
|
||||||
s.chars().fold(String::with_capacity(s.len()), |mut s, c| {
|
s.chars().fold(String::with_capacity(s.len()), |mut s, c| {
|
||||||
if CHARS.contains(&c) {
|
if CHARS.contains(&c) {
|
||||||
|
|
Loading…
Reference in a new issue