Fix typos (#277)

This commit is contained in:
Kian-Meng Ang 2022-06-20 20:35:17 +08:00 committed by GitHub
commit 97b4395e25
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View file

@ -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>(
@ -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())

View file

@ -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();