Skip to content

Commit

Permalink
Fix typos (#277)
Browse files Browse the repository at this point in the history
  • Loading branch information
kianmeng committed Jun 20, 2022
1 parent 543fa22 commit 97b4395
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/formatter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ fn highlight_code<'a, E>(
Ok(())
}

/// Yields `NormalCode` and `CommandName` in alternating order according to the occurences of
/// Yields `NormalCode` and `CommandName` in alternating order according to the occurrences of
/// `command_name` in `segment`. Variables are not detected here, see `highlight_code`
/// instead.
fn highlight_code_segment<'a, E>(
Expand Down Expand Up @@ -113,15 +113,15 @@ fn highlight_code_segment<'a, E>(
}

/// Checks whether the characters right before and after the substring (given by half-open index interval) are whitespace (if they exist).
fn is_freestanding_substring(surrouding: &str, substring: (usize, usize)) -> bool {
fn is_freestanding_substring(surrounding: &str, substring: (usize, usize)) -> bool {
let (start, end) = substring;
// "okay" meaning <exists and is whitespace> or <doesn't exist>
let char_before_is_okay = surrouding[..start]
let char_before_is_okay = surrounding[..start]
.chars()
.last()
.filter(|prev_char| !prev_char.is_whitespace())
.is_none();
let char_after_is_okay = surrouding[end..]
let char_after_is_okay = surrounding[end..]
.chars()
.next()
.filter(|next_char| !next_char.is_whitespace())
Expand Down
2 changes: 1 addition & 1 deletion tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ fn test_custom_page_overwrites() {
.stdout(diff(expected));
}

/// End-End test to ensure that .patch files are appened to pages in the cache_dir
/// End-End test to ensure that .patch files are appended to pages in the cache_dir
#[test]
fn test_custom_patch_appends_to_common() {
let testenv = TestEnv::new();
Expand Down

0 comments on commit 97b4395

Please sign in to comment.