mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-31 05:26:23 +03:00
Documentation
This commit is contained in:
@@ -218,6 +218,9 @@ fn parse_command(&mut self, command: &str, l: usize) -> Result<()> {
|
||||
self.env_vars.push((k.to_string(), v.to_string()));
|
||||
},
|
||||
"normalize-stderr-test" => {
|
||||
/// Parses a string literal. `s` has to start with `"`; everything until the next `"` is
|
||||
/// returned in the first component. `\` can be used to escape arbitrary character.
|
||||
/// Second return component is the rest of the string with leading whitespace removed.
|
||||
fn parse_str(s: &str) -> Result<(&str, &str)> {
|
||||
let mut chars = s.char_indices();
|
||||
match chars.next().ok_or_else(|| eyre!("missing arguments"))?.1 {
|
||||
@@ -226,6 +229,7 @@ fn parse_str(s: &str) -> Result<(&str, &str)> {
|
||||
let mut escaped = false;
|
||||
for (i, c) in chars {
|
||||
if escaped {
|
||||
// Accept any character as literal after a `\`.
|
||||
escaped = false;
|
||||
} else if c == '"' {
|
||||
return Ok((&s[..(i - 1)], s[i..].trim_start()));
|
||||
|
||||
Reference in New Issue
Block a user