diff options
| author | Marcus Klaas <mail@marcusklaas.nl> | 2016-05-09 20:11:25 +0200 |
|---|---|---|
| committer | Marcus Klaas <mail@marcusklaas.nl> | 2016-05-12 21:15:06 +0200 |
| commit | cd158cecc87cb2d4d63aecf8854952370cb9ea4b (patch) | |
| tree | 8d1cc8700cd73e5892d7bb8208ee067d5c3a2dbb /tests | |
| parent | ee7b5805fcb1e4bc6334b7a6a814769d4606541d (diff) | |
Add try macro to try shorthand conversion tests
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/source/chains.rs | 4 | ||||
| -rw-r--r-- | tests/source/try-conversion.rs | 11 | ||||
| -rw-r--r-- | tests/target/chains.rs | 9 | ||||
| -rw-r--r-- | tests/target/try-conversion.rs | 18 |
4 files changed, 42 insertions, 0 deletions
diff --git a/tests/source/chains.rs b/tests/source/chains.rs index 8ec5cd191c5..48de948865b 100644 --- a/tests/source/chains.rs +++ b/tests/source/chains.rs @@ -120,4 +120,8 @@ fn try_shorthand() { let yyyy = expr?.another?.another?.another?.another?.another?.another?.another?.another?.test(); let zzzz = expr?.another?.another?.another?.another?; let aaa = x ???????????? ?????????????? ???? ????? ?????????????? ????????? ?????????????? ??; + + let y = a.very .loooooooooooooooooooooooooooooooooooooong() .chain() + .inside() .weeeeeeeeeeeeeee()? .test() .0 + .x; } diff --git a/tests/source/try-conversion.rs b/tests/source/try-conversion.rs new file mode 100644 index 00000000000..addf2f5d5e8 --- /dev/null +++ b/tests/source/try-conversion.rs @@ -0,0 +1,11 @@ +// rustfmt-use_try_shorthand: true + +fn main() { + let x = try!(some_expr()); + + let y = try!(a.very.loooooooooooooooooooooooooooooooooooooong().chain().inside().weeeeeeeeeeeeeee()).test().0.x; +} + +fn test() { + a? +} diff --git a/tests/target/chains.rs b/tests/target/chains.rs index 4c38ab7eb52..2298b5e1714 100644 --- a/tests/target/chains.rs +++ b/tests/target/chains.rs @@ -145,4 +145,13 @@ fn try_shorthand() { let yyyy = expr?.another?.another?.another?.another?.another?.another?.another?.another?.test(); let zzzz = expr?.another?.another?.another?.another?; let aaa = x??????????????????????????????????????????????????????????????????????????; + + let y = a.very + .loooooooooooooooooooooooooooooooooooooong() + .chain() + .inside() + .weeeeeeeeeeeeeee()? + .test() + .0 + .x; } diff --git a/tests/target/try-conversion.rs b/tests/target/try-conversion.rs new file mode 100644 index 00000000000..2daaba88490 --- /dev/null +++ b/tests/target/try-conversion.rs @@ -0,0 +1,18 @@ +// rustfmt-use_try_shorthand: true + +fn main() { + let x = some_expr()?; + + let y = a.very + .loooooooooooooooooooooooooooooooooooooong() + .chain() + .inside() + .weeeeeeeeeeeeeee()? + .test() + .0 + .x; +} + +fn test() { + a? +} |
