|
|
@ -35,7 +35,7 @@ impl FromStr for Scopes { |
|
|
|
fn from_str(s: &str) -> Result<Scopes, Self::Err> { |
|
|
|
fn from_str(s: &str) -> Result<Scopes, Self::Err> { |
|
|
|
let mut set = HashSet::new(); |
|
|
|
let mut set = HashSet::new(); |
|
|
|
for scope in s.split_whitespace() { |
|
|
|
for scope in s.split_whitespace() { |
|
|
|
let scope = Scope::from_str(&scope)?; |
|
|
|
let scope = Scope::from_str(scope)?; |
|
|
|
set.insert(scope); |
|
|
|
set.insert(scope); |
|
|
|
} |
|
|
|
} |
|
|
|
Ok(Scopes { scopes: set }) |
|
|
|
Ok(Scopes { scopes: set }) |
|
|
@ -792,7 +792,7 @@ mod tests { |
|
|
|
("push", Scope::Push), |
|
|
|
("push", Scope::Push), |
|
|
|
]; |
|
|
|
]; |
|
|
|
for (source, expected) in &tests { |
|
|
|
for (source, expected) in &tests { |
|
|
|
let result = Scope::from_str(source).expect(&format!("Couldn't parse '{}'", &source)); |
|
|
|
let result = Scope::from_str(source).unwrap_or_else(|_| panic!("Couldn't parse '{}'", &source)); |
|
|
|
assert_eq!(result, *expected); |
|
|
|
assert_eq!(result, *expected); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|