diff options
author | Martin Fischer <martin@push-f.com> | 2023-08-16 16:27:18 +0200 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2023-08-19 06:41:55 +0200 |
commit | c021afde2c2bd4b8bdd9b3eec4b1660cb0a896e5 (patch) | |
tree | c985ba6608532cbeea4909822a8b755a59c1b35c /html5lib_tests/src | |
parent | 379b2ed4b6665784c5d0ffea777e3df5ae84aa86 (diff) |
chore(html5lib_tests): simplify control flow
Diffstat (limited to 'html5lib_tests/src')
-rw-r--r-- | html5lib_tests/src/lib.rs | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/html5lib_tests/src/lib.rs b/html5lib_tests/src/lib.rs index 5678b0d..c007317 100644 --- a/html5lib_tests/src/lib.rs +++ b/html5lib_tests/src/lib.rs @@ -188,27 +188,21 @@ struct Tests { } fn undo_double_escaping(mut test: Test) -> Test { - test.input = if test.double_escaped { - unescape(&test.input) - } else { - test.input - }; - - test.output = if test.double_escaped { - ExpectedOutputTokens( - test.output - .0 - .into_iter() - .map(|token| match token { - Token::String(x) => Token::String(unescape(&x)), - Token::Comment(x) => Token::Comment(unescape(&x)), - token => token, - }) - .collect(), - ) - } else { - ExpectedOutputTokens(test.output.0) - }; + if test.double_escaped { + test.input = unescape(&test.input); + + test.output.0 = test + .output + .0 + .into_iter() + .map(|token| match token { + Token::String(x) => Token::String(unescape(&x)), + Token::Comment(x) => Token::Comment(unescape(&x)), + token => token, + }) + .collect(); + } + test } |