Repository navigation
Conversation
Merging this PR will degrade performance by 30.98%1 warning
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing |
|
i dont know how to optimize it... |
|
|
||
| while let Some(param) = opts.next() { | ||
| if to.is_none() { | ||
| last_arg = param.clone(); |
There was a problem hiding this comment.
this clones every argument, probably the 30% regression on the cmp_parser bench.
it only matters while from is none, could you please clone only then?
| let bytes = param.as_bytes(); | ||
| let mut suffix_start = 0; | ||
|
|
||
| while suffix_start < bytes.len() && bytes[suffix_start].is_ascii_digit() { |
There was a problem hiding this comment.
unrelated to the error messages (same for saturating_mul and parse_skip), please split into another PR
| return Err(usage_string(&executable_str)); | ||
| return Err(usage_error( | ||
| &executable_str, | ||
| "invalid --ignore-initial value '-'", |
There was a problem hiding this comment.
with cmp a b 1 2 - this should be extra operand '-', no?
| .args(&["-l", "-s", "/etc/passwd", "/etc/group"]) | ||
| .fails_with_code(2) | ||
| .stderr_str_check(|s| s.ends_with(": options -l and -s are incompatible\n")); | ||
| .stderr_str_check(|s| s.contains(": options -l and -s are incompatible\n")); |
There was a problem hiding this comment.
the description mentions new integration tests but i don't see them.
please add tests here for missing operand, extra operand (also after --), unrecognized option and -n/-i without argument
6c210fd to
225f90d
Compare
…dd integration tests
4d10ab8 to
f243fd2
Compare
|
@sylvestre i think ive done everything you said |
Fixes #347
Fixes #177
This PR updates command-line usage error messages in
cmpto match GNUcmpbehavior:<executable>:) to all usage error messages.<executable>: Try '<executable> --help' for more information.hint line.missing operand after '...',extra operand '...',unrecognized option '...', andoption requires an argument -- '...') instead of a genericUsage:line.stderroutput.