diff --git a/src/cm.rs b/src/cm.rs index 7e1da213..13969563 100644 --- a/src/cm.rs +++ b/src/cm.rs @@ -544,13 +544,12 @@ impl<'a, 'o, 'c> CommonMarkFormatter<'a, 'o, 'c> { let info = ncb.info.as_bytes(); let literal = ncb.literal.as_bytes(); - if info.is_empty() - && (literal.len() > 2 - && !isspace(literal[0]) - && !(isspace(literal[literal.len() - 1]) - && isspace(literal[literal.len() - 2]))) - && !first_in_list_item - && !self.options.render.prefer_fenced + if !(!info.is_empty() + || literal.len() <= 2 + || isspace(literal[0]) + || first_in_list_item + || self.options.render.prefer_fenced + || isspace(literal[literal.len() - 1]) && isspace(literal[literal.len() - 2])) { write!(self, " ").unwrap(); write!(self.prefix, " ").unwrap(); diff --git a/src/parser/autolink.rs b/src/parser/autolink.rs index a4361da6..15e8e315 100644 --- a/src/parser/autolink.rs +++ b/src/parser/autolink.rs @@ -41,14 +41,11 @@ pub(crate) fn process_autolinks<'a>( } } - match contents[i] { - b'@' => { - post_org = email_match(arena, contents, i, relaxed_autolinks); - if post_org.is_some() { - break; - } + if contents[i] == b'@' { + post_org = email_match(arena, contents, i, relaxed_autolinks); + if post_org.is_some() { + break; } - _ => (), } i += 1; } @@ -161,7 +158,7 @@ fn check_domain(data: &[u8], allow_short: bool) -> Option { } fn is_valid_hostchar(ch: char) -> bool { - !ch.is_whitespace() && !(ch.is_punctuation() || ch.is_symbol()) + !(ch.is_whitespace() || ch.is_punctuation() || ch.is_symbol()) } fn autolink_delim(data: &[u8], mut link_end: usize, relaxed_autolinks: bool) -> usize {