Skip to content

Commit

Permalink
Removed some unnecessary borrows (#426)
Browse files Browse the repository at this point in the history
  • Loading branch information
vallentin committed Feb 8, 2020
1 parent 7a1d855 commit 03e64b2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/parse.rs
Expand Up @@ -780,8 +780,8 @@ impl<'a> FirstPass<'a> {
c @ b'*' | c @ b'_' | c @ b'~' => {
let string_suffix = &self.text[ix..];
let count = 1 + scan_ch_repeat(&string_suffix.as_bytes()[1..], c);
let can_open = delim_run_can_open(&self.text, string_suffix, count, ix);
let can_close = delim_run_can_close(&self.text, string_suffix, count, ix);
let can_open = delim_run_can_open(self.text, string_suffix, count, ix);
let can_close = delim_run_can_close(self.text, string_suffix, count, ix);
let is_valid_seq = c != b'~'
|| count == 2 && self.options.contains(Options::ENABLE_STRIKETHROUGH);

Expand Down Expand Up @@ -1323,10 +1323,10 @@ impl<'a> FirstPass<'a> {
let bytes = self.text.as_bytes();

// whitespace between label and url (including up to one newline)
let (mut i, _newlines) = self.scan_refdef_space(&bytes, start)?;
let (mut i, _newlines) = self.scan_refdef_space(bytes, start)?;

// scan link dest
let (dest_length, dest) = scan_link_dest(&self.text, i, 1)?;
let (dest_length, dest) = scan_link_dest(self.text, i, 1)?;
if dest_length == 0 {
return None;
}
Expand All @@ -1338,7 +1338,7 @@ impl<'a> FirstPass<'a> {

// scan whitespace between dest and label
let (mut i, newlines) =
if let Some((new_i, mut newlines)) = self.scan_refdef_space(&bytes, i) {
if let Some((new_i, mut newlines)) = self.scan_refdef_space(bytes, i) {
if i == self.text.len() {
newlines += 1;
}
Expand Down
2 changes: 1 addition & 1 deletion src/scanners.rs
Expand Up @@ -993,7 +993,7 @@ pub(crate) fn scan_html_block_inner(
data: &[u8],
newline_handler: Option<&dyn Fn(&[u8]) -> usize>,
) -> Option<usize> {
let close_tag_bytes = scan_ch(&data, b'/');
let close_tag_bytes = scan_ch(data, b'/');
let l = scan_while(&data[close_tag_bytes..], is_ascii_alpha);
if l == 0 {
return None;
Expand Down

0 comments on commit 03e64b2

Please sign in to comment.