Skip to content

Commit ebddc29

Browse files
committed
minor typo and error msg fixes
1 parent 40373c7 commit ebddc29

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

display/more.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,7 @@ struct SourceContext {
940940
current_pattern: String,
941941
/// Last search settings
942942
last_search: Option<(Regex, bool, Direction)>,
943-
/// Storage for marks that were set durring current [`Source`] processing
943+
/// Storage for marks that were set during current [`Source`] processing
944944
marked_positions: HashMap<char, usize>,
945945
/// Flag that [`true`] if input files count is more that 1
946946
is_many_files: bool,

text/csplit.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,10 @@ fn parse_op_rx(opstr: &str, delim: char) -> io::Result<Operand> {
492492
fn parse_op_repeat(opstr: &str) -> io::Result<Operand> {
493493
// Must match pattern: {num} or {*}
494494
if !opstr.starts_with('{') || !opstr.ends_with('}') {
495-
return Err(Error::new(ErrorKind::Other, "invalid repeating operand"));
495+
return Err(Error::new(
496+
ErrorKind::Other,
497+
"invalid repeat operand: expected {num} or {*}",
498+
));
496499
}
497500

498501
let inner = &opstr[1..opstr.len() - 1];
@@ -509,7 +512,10 @@ fn parse_op_repeat(opstr: &str) -> io::Result<Operand> {
509512
}
510513
}
511514

512-
Err(Error::new(ErrorKind::Other, "invalid repeating operand"))
515+
Err(Error::new(
516+
ErrorKind::Other,
517+
"invalid repeat operand: expected {num} or {*}",
518+
))
513519
}
514520

515521
/// Parses a line number operand from a string.
@@ -778,7 +784,7 @@ mod tests {
778784
match parse_op_repeat(opstr) {
779785
Err(e) => {
780786
assert_eq!(e.kind(), ErrorKind::Other);
781-
assert_eq!(e.to_string(), "invalid repeating operand");
787+
assert!(e.to_string().starts_with("invalid repeat operand"));
782788
}
783789
_ => panic!("Expected Err"),
784790
}
@@ -790,7 +796,7 @@ mod tests {
790796
match parse_op_repeat(opstr) {
791797
Err(e) => {
792798
assert_eq!(e.kind(), ErrorKind::Other);
793-
assert_eq!(e.to_string(), "invalid repeating operand");
799+
assert!(e.to_string().starts_with("invalid repeat operand"));
794800
}
795801
_ => panic!("Expected Err"),
796802
}

text/sed.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ fn delete_nested_ranges(mut ranges: Vec<(usize, Range<usize>)>) -> Vec<(usize, R
493493
}
494494

495495
/// The regex can return from 1 to 9 range. Some
496-
/// of them cam be invalid for usage. So this function filter
496+
/// of them can be invalid for usage. So this function filters
497497
/// invalid ranges.
498498
fn filter_groups(groups: &mut Vec<(usize, Range<usize>)>, pattern: &str, haystack: &str) {
499499
groups.retain(|(_, m)| {

0 commit comments

Comments
 (0)