(value: &OsStr, spelling: &str)
| 393 | } |
| 394 | |
| 395 | fn attached_value(value: &OsStr, spelling: &str) -> Option<OsString> { |
| 396 | let prefixes = if spelling.starts_with("--") { |
| 397 | vec![format!("{spelling}=")] |
| 398 | } else { |
| 399 | vec![format!("{spelling}="), spelling.to_string()] |
| 400 | }; |
| 401 | |
| 402 | for prefix in prefixes { |
| 403 | if let Some(value) = value.to_str() { |
| 404 | if let Some(suffix) = value.strip_prefix(&prefix) { |
| 405 | return Some(OsString::from(suffix)); |
| 406 | } |
| 407 | } else if let Some(value) = attached_non_utf8_value(value, &prefix) { |
| 408 | return Some(value); |
| 409 | } |
| 410 | } |
| 411 | None |
| 412 | } |
| 413 | |
| 414 | #[cfg(unix)] |
| 415 | fn attached_non_utf8_value(value: &OsStr, prefix: &str) -> Option<OsString> { |
no test coverage detected