pr: pr panics (Option::unwrap() on None) in merge mode -m on empty input #12995#13080
Conversation
Merging this PR will improve performance by 9.35%
Performance Changes
Tip Curious why this is faster? Comment Comparing Footnotes
|
|
GNU testsuite comparison: |
| } | ||
| } | ||
| } | ||
| result.push((current_key.unwrap(), current_group)); |
There was a problem hiding this comment.
The condition on line 1106 is done because of the .unwrap() here. So I would wrap this line with a condition and remove the other condition. Something like:
if let Some(k) = current_key {
result.push((k, current_group));
}There was a problem hiding this comment.
Yeah, looks better, thanks!
| new_ucmd!() | ||
| .args(&["-m", "/dev/null", "/dev/null"]) | ||
| .succeeds() | ||
| .stdout_is(""); |
There was a problem hiding this comment.
A detail: here you could use .no_output() or .no_stdout() instead of .stdout_is("").
|
Thanks! |
This PR resolves #12995
GNU pr exits with silently with code 0, whenever the input in merge mode is an empty file.