Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed some unnecessary borrows #426

Merged
merged 1 commit into from Feb 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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