Restrict short-hand flag detection to exact match. (#1406)

This commit is contained in:
Andrés N. Robalino
2020-02-18 01:58:30 -05:00
committed by GitHub
parent 0f7c723672
commit 18d988d4c8
2 changed files with 30 additions and 2 deletions

View File

@ -368,8 +368,13 @@ impl SpannedToken {
match flag.kind {
FlagKind::Longhand if value == name => Some(*flag),
FlagKind::Shorthand if short.is_some() && short == name.chars().next() => {
Some(*flag)
FlagKind::Shorthand => {
if let Some(short_hand) = short {
if short_hand.to_string() == name {
return Some(*flag);
}
}
None
}
_ => None,
}