From 97b4395e258ae809060dd6cdceb5cab9c76dadcc Mon Sep 17 00:00:00 2001 From: Kian-Meng Ang Date: Mon, 20 Jun 2022 20:35:17 +0800 Subject: [PATCH] Fix typos (#277) --- src/formatter.rs | 8 ++++---- tests/lib.rs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/formatter.rs b/src/formatter.rs index c87d39b..d5e3b32 100644 --- a/src/formatter.rs +++ b/src/formatter.rs @@ -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 or - 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()) diff --git a/tests/lib.rs b/tests/lib.rs index 7c54477..1b25bdb 100644 --- a/tests/lib.rs +++ b/tests/lib.rs @@ -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();