From 3d50a2000371eb447d4f551f6c752a56e044e10b Mon Sep 17 00:00:00 2001 From: Kian-Meng Ang Date: Sat, 18 Jun 2022 20:32:34 +0800 Subject: [PATCH] Fix typos --- src/firstpass.rs | 8 ++++---- src/linklabel.rs | 2 +- src/parse.rs | 4 ++-- src/scanners.rs | 2 +- tests/lib.rs | 10 +++++----- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/firstpass.rs b/src/firstpass.rs index 5af74318..cf3cfbf5 100644 --- a/src/firstpass.rs +++ b/src/firstpass.rs @@ -69,7 +69,7 @@ impl<'a, 'b> FirstPass<'a, 'b> { } if self.options.contains(Options::ENABLE_FOOTNOTES) { - // finish footnote if it's still open and was preceeded by blank line + // finish footnote if it's still open and was preceded by blank line if let Some(node_ix) = self.tree.peek_up() { if let ItemBody::FootnoteDefinition(..) = self.tree[node_ix].item.body { if self.last_line_blank { @@ -864,7 +864,7 @@ impl<'a, 'b> FirstPass<'a, 'b> { let bytes = self.text.as_bytes(); let mut info_start = start_ix + n_fence_char; info_start += scan_whitespace_no_nl(&bytes[info_start..]); - // TODO: info strings are typically very short. wouldnt it be faster + // TODO: info strings are typically very short. wouldn't it be faster // to just do a forward scan here? let mut ix = info_start + scan_nextline(&bytes[info_start..]); let info_end = ix - scan_rev_while(&bytes[info_start..ix], is_ascii_whitespace); @@ -1277,14 +1277,14 @@ enum TableParseMode { } /// Computes the number of header columns in a table line by computing the number of dividing pipes -/// that aren't followed or preceeded by whitespace. +/// that aren't followed or preceded by whitespace. fn count_header_cols( bytes: &[u8], mut pipes: usize, mut start: usize, last_pipe_ix: usize, ) -> usize { - // was first pipe preceeded by whitespace? if so, subtract one + // was first pipe preceded by whitespace? if so, subtract one start += scan_whitespace_no_nl(&bytes[start..]); if bytes[start] == b'|' { pipes -= 1; diff --git a/src/linklabel.rs b/src/linklabel.rs index 7050ea8f..23b4b828 100644 --- a/src/linklabel.rs +++ b/src/linklabel.rs @@ -46,7 +46,7 @@ pub(crate) fn scan_link_label_rest<'t>( let mut ix = 0; let mut only_white_space = true; let mut codepoints = 0; - // no worries, doesnt allocate until we push things onto it + // no worries, doesn't allocate until we push things onto it let mut label = String::new(); let mut mark = 0; diff --git a/src/parse.rs b/src/parse.rs index 37e87ee8..8355ce2f 100644 --- a/src/parse.rs +++ b/src/parse.rs @@ -62,10 +62,10 @@ pub(crate) enum ItemBody { MaybeEmphasis(usize, bool, bool), // quote byte, can_open, can_close MaybeSmartQuote(u8, bool, bool), - MaybeCode(usize, bool), // number of backticks, preceeded by backslash + MaybeCode(usize, bool), // number of backticks, preceded by backslash MaybeHtml, MaybeLinkOpen, - // bool indicates whether or not the preceeding section could be a reference + // bool indicates whether or not the preceding section could be a reference MaybeLinkClose(bool), MaybeImage, diff --git a/src/scanners.rs b/src/scanners.rs index 9de26de7..176c495e 100644 --- a/src/scanners.rs +++ b/src/scanners.rs @@ -880,7 +880,7 @@ fn scan_attribute( /// Scans whitespace and possibly newlines according to the /// behavior defined by the newline handler. When bytes are skipped, -/// all preceeding non-skipped bytes are pushed to the buffer. +/// all preceding non-skipped bytes are pushed to the buffer. fn scan_whitespace_with_newline_handler( data: &[u8], mut i: usize, diff --git a/tests/lib.rs b/tests/lib.rs index 3f99445a..45bf7f71 100644 --- a/tests/lib.rs +++ b/tests/lib.rs @@ -262,13 +262,13 @@ fn normalize_node(parent: &Handle, node: &mut Handle) -> bool { pos != 0, "If node is not first, then node's position shall not be zero" ); - let mut preceeding = siblings[pos - 1].clone(); + let mut preceding = siblings[pos - 1].clone(); 'descent: loop { - if let NodeData::Text { .. } = preceeding.data { + if let NodeData::Text { .. } = preceding.data { break 'descent; } - preceeding = { - let ch = preceeding.children.borrow(); + preceding = { + let ch = preceding.children.borrow(); if ch.len() == 0 { break 'descent; } @@ -279,7 +279,7 @@ fn normalize_node(parent: &Handle, node: &mut Handle) -> bool { } }; } - if let NodeData::Text { ref contents, .. } = preceeding.data { + if let NodeData::Text { ref contents, .. } = preceding.data { break 'ascent TRAILING_WHITESPACE_RE.is_match(&*contents.borrow()); } else { break 'ascent false;