Skip to content

Commit

Permalink
Fix some clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
digitalmoksha committed Aug 15, 2024
1 parent ba69381 commit 3b507df
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
13 changes: 6 additions & 7 deletions src/cm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
13 changes: 5 additions & 8 deletions src/parser/autolink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -161,7 +158,7 @@ fn check_domain(data: &[u8], allow_short: bool) -> Option<usize> {
}

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 {
Expand Down

0 comments on commit 3b507df

Please sign in to comment.