Auto merge of #19854 - emilio:try-match, r=nox

style: make the try_match_ident_ignore_ascii_case macro actually return the error.

This allows it to be used as an expression, which I'd like to do very soon.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19854)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2018-01-25 10:18:24 -06:00 committed by GitHub
commit 5355265c74
2 changed files with 10 additions and 11 deletions

View file

@ -293,8 +293,9 @@ impl Parse for TextDecorationLine {
}
loop {
let result: Result<_, ParseError> = input.try(|input| {
try_match_ident_ignore_ascii_case! { input,
let result = input.try(|input| {
let ident = input.expect_ident().map_err(|_| ())?;
match_ignore_ascii_case! { ident,
"underline" => {
if result.contains(TextDecorationLine::UNDERLINE) {
Err(())
@ -327,6 +328,7 @@ impl Parse for TextDecorationLine {
Ok(())
}
}
_ => Err(()),
}
});
if result.is_err() {