Repository navigation
Conversation
- Fix failing test tests/ui/process/issue-16272.rs for UEFI. - Basically, if the last quoted arg was empty, it was ignored in the current implementation. This behaviour is incorrect and was already fixed on windows in the past. Do the same for UEFI. Signed-off-by: Ayush Singh <ayush@beagleboard.org>
|
rustbot has assigned @Mark-Simulacrum. Use Why was this reviewer chosen?The reviewer was selected based on:
|
| QUOTE if in_quotes => match code_units_iter.peek() { | ||
| // The end of the command line. | ||
| // Push `cur` even if empty, which we do by breaking while `in_quotes` is still set. | ||
| None | Some(Ok(NULL)) => break, | ||
| // Close `in_quotes`. | ||
| Some(_) => in_quotes = false, | ||
| }, | ||
| // If not `in_quotes` and not escaped (see above) then a quote sets `in_quote`. | ||
| QUOTE => in_quotes = true, |
There was a problem hiding this comment.
I find this much less clear than just a regular if-else.
Your "see above" comment kinda indicates you do too ^^
There was a problem hiding this comment.
Example rewrite:
| QUOTE if in_quotes => match code_units_iter.peek() { | |
| // The end of the command line. | |
| // Push `cur` even if empty, which we do by breaking while `in_quotes` is still set. | |
| None | Some(Ok(NULL)) => break, | |
| // Close `in_quotes`. | |
| Some(_) => in_quotes = false, | |
| }, | |
| // If not `in_quotes` and not escaped (see above) then a quote sets `in_quote`. | |
| QUOTE => in_quotes = true, | |
| QUOTE => { | |
| if in_quotes && matches!(code_units_iter.peek(), None | Some(Ok(NULL))) { | |
| // Push `cur` even if empty, which we do by breaking while `in_quotes` is still set. | |
| // This is to avoid empty quotes being ignored as the last argument. | |
| break; | |
| } | |
| in_quotes = !in_quotes; | |
| } |
There was a problem hiding this comment.
Well, the current code was to preserve it's windows impl shape:
rust/library/std/src/sys/args/windows.rs
Line 131 in ee8268e
This whole function was deliberately written to mirror it's windows counterpart as closely as possible since other than some slight differences, most of the logic is the same (and so are the comments).
With that said, I personally don't have any objection to above change. The readability seems the same to me.
|
Reminder, once the PR becomes ready for a review, use |
Uh oh!
There was an error while loading. Please reload this page.