format the code

This commit is contained in:
YouKnow 2024-04-03 04:44:55 +03:30
parent 67ca69c142
commit 95ebe2a764

View file

@ -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) {