From 00a2e17c8032f9dc40eb511e00ef7fd314c92a77 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 30 May 2021 00:07:01 -0500 Subject: [PATCH] refactor/splice ~ polish spelling (comments, names, and exceptions) --- src/uu/cat/src/splice.rs | 2 +- src/uu/csplit/src/csplit.rs | 6 +++--- src/uu/csplit/src/patterns.rs | 4 +++- .../csplit/src/{splitname.rs => split_name.rs} | 16 ++++++++++------ 4 files changed, 17 insertions(+), 11 deletions(-) rename src/uu/csplit/src/{splitname.rs => split_name.rs} (98%) diff --git a/src/uu/cat/src/splice.rs b/src/uu/cat/src/splice.rs index bd6be60f1..0b46fc662 100644 --- a/src/uu/cat/src/splice.rs +++ b/src/uu/cat/src/splice.rs @@ -9,7 +9,7 @@ const BUF_SIZE: usize = 1024 * 16; /// This function is called from `write_fast()` on Linux and Android. The /// function `splice()` is used to move data between two file descriptors -/// without copying between kernel- and userspace. This results in a large +/// without copying between kernel and user spaces. This results in a large /// speedup. /// /// The `bool` in the result value indicates if we need to fall back to normal diff --git a/src/uu/csplit/src/csplit.rs b/src/uu/csplit/src/csplit.rs index 43f95fff5..a2eb8604a 100644 --- a/src/uu/csplit/src/csplit.rs +++ b/src/uu/csplit/src/csplit.rs @@ -13,10 +13,10 @@ use std::{ mod csplit_error; mod patterns; -mod splitname; +mod split_name; use crate::csplit_error::CsplitError; -use crate::splitname::SplitName; +use crate::split_name::SplitName; use uucore::InvalidEncodingHandling; static VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -77,7 +77,7 @@ impl CsplitOptions { /// # Errors /// /// - [`io::Error`] if there is some problem reading/writing from/to a file. -/// - [`::CsplitError::LineOutOfRange`] if the linenum pattern is larger than the number of input +/// - [`::CsplitError::LineOutOfRange`] if the line number pattern is larger than the number of input /// lines. /// - [`::CsplitError::LineOutOfRangeOnRepetition`], like previous but after applying the pattern /// more than once. diff --git a/src/uu/csplit/src/patterns.rs b/src/uu/csplit/src/patterns.rs index d2f14578a..5621d18a3 100644 --- a/src/uu/csplit/src/patterns.rs +++ b/src/uu/csplit/src/patterns.rs @@ -1,3 +1,5 @@ +// spell-checker:ignore (regex) SKIPTO UPTO ; (vars) ntimes + use crate::csplit_error::CsplitError; use regex::Regex; @@ -167,7 +169,7 @@ fn validate_line_numbers(patterns: &[Pattern]) -> Result<(), CsplitError> { .try_fold(0, |prev_ln, ¤t_ln| match (prev_ln, current_ln) { // a line number cannot be zero (_, 0) => Err(CsplitError::LineNumberIsZero), - // two consecutifs numbers should not be equal + // two consecutive numbers should not be equal (n, m) if n == m => { show_warning!("line number '{}' is the same as preceding line number", n); Ok(n) diff --git a/src/uu/csplit/src/splitname.rs b/src/uu/csplit/src/split_name.rs similarity index 98% rename from src/uu/csplit/src/splitname.rs rename to src/uu/csplit/src/split_name.rs index 66b17ba67..6db781e9b 100644 --- a/src/uu/csplit/src/splitname.rs +++ b/src/uu/csplit/src/split_name.rs @@ -1,3 +1,5 @@ +// spell-checker:ignore (regex) diuox + use regex::Regex; use crate::csplit_error::CsplitError; @@ -225,6 +227,8 @@ impl SplitName { #[cfg(test)] mod tests { + // spell-checker:ignore (path) xxcst + use super::*; #[test] @@ -319,13 +323,13 @@ mod tests { } #[test] - fn zero_padding_lower_hexa() { + fn zero_padding_lower_hex() { let split_name = SplitName::new(None, Some(String::from("cst-%03x-")), None).unwrap(); assert_eq!(split_name.get(42), "xxcst-02a-"); } #[test] - fn zero_padding_upper_hexa() { + fn zero_padding_upper_hex() { let split_name = SplitName::new(None, Some(String::from("cst-%03X-")), None).unwrap(); assert_eq!(split_name.get(42), "xxcst-02A-"); } @@ -337,13 +341,13 @@ mod tests { } #[test] - fn alternate_form_lower_hexa() { + fn alternate_form_lower_hex() { let split_name = SplitName::new(None, Some(String::from("cst-%#10x-")), None).unwrap(); assert_eq!(split_name.get(42), "xxcst- 0x2a-"); } #[test] - fn alternate_form_upper_hexa() { + fn alternate_form_upper_hex() { let split_name = SplitName::new(None, Some(String::from("cst-%#10X-")), None).unwrap(); assert_eq!(split_name.get(42), "xxcst- 0x2A-"); } @@ -373,13 +377,13 @@ mod tests { } #[test] - fn left_adjusted_lower_hexa() { + fn left_adjusted_lower_hex() { let split_name = SplitName::new(None, Some(String::from("cst-%-10x-")), None).unwrap(); assert_eq!(split_name.get(42), "xxcst-0x2a -"); } #[test] - fn left_adjusted_upper_hexa() { + fn left_adjusted_upper_hex() { let split_name = SplitName::new(None, Some(String::from("cst-%-10X-")), None).unwrap(); assert_eq!(split_name.get(42), "xxcst-0x2A -"); }