move single component parsing to dedicated function
this will prevent parsing when expecting more than a single component to be parsed, and prepare for the symetric variant-to-name function to be added
This commit is contained in:
parent
acc3b61c5e
commit
2ce46f8e8c
3 changed files with 12 additions and 13 deletions
|
@ -539,18 +539,17 @@ bitflags::bitflags! {
|
|||
}
|
||||
}
|
||||
|
||||
impl FromStr for LinkSelfContainedComponents {
|
||||
type Err = ();
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
Ok(match s {
|
||||
impl LinkSelfContainedComponents {
|
||||
/// Parses a single `-Clink-self-contained` well-known component, not a set of flags.
|
||||
pub fn from_str(s: &str) -> Option<LinkSelfContainedComponents> {
|
||||
Some(match s {
|
||||
"crto" => LinkSelfContainedComponents::CRT_OBJECTS,
|
||||
"libc" => LinkSelfContainedComponents::LIBC,
|
||||
"unwind" => LinkSelfContainedComponents::UNWIND,
|
||||
"linker" => LinkSelfContainedComponents::LINKER,
|
||||
"sanitizers" => LinkSelfContainedComponents::SANITIZERS,
|
||||
"mingw" => LinkSelfContainedComponents::MINGW,
|
||||
_ => return Err(()),
|
||||
_ => return None,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue