diff options
| author | klensy <klensy@users.noreply.github.com> | 2025-06-17 17:21:46 +0300 |
|---|---|---|
| committer | klensy <klensy@users.noreply.github.com> | 2025-06-21 12:42:40 +0300 |
| commit | dc3b8bef8052a6dbd877cd9ecc4c26592685aa4c (patch) | |
| tree | ab54d6375710f7e87b8a834cc8bc9a24a6c992be | |
| parent | 7c828e63ba4ce7a6365b74dceae1474749e303d9 (diff) | |
| download | rust-dc3b8bef8052a6dbd877cd9ecc4c26592685aa4c.tar.gz rust-dc3b8bef8052a6dbd877cd9ecc4c26592685aa4c.zip | |
precommit test
| -rw-r--r-- | tests/ui/or_fun_call.fixed | 18 | ||||
| -rw-r--r-- | tests/ui/or_fun_call.rs | 18 |
2 files changed, 36 insertions, 0 deletions
diff --git a/tests/ui/or_fun_call.fixed b/tests/ui/or_fun_call.fixed index 34f3e046841..bb46ce04466 100644 --- a/tests/ui/or_fun_call.fixed +++ b/tests/ui/or_fun_call.fixed @@ -439,4 +439,22 @@ fn test_option_get_or_insert() { //~^ or_fun_call } +fn test_option_and() { + // assume that this is slow call + fn g() -> Option<u8> { + Some(99) + } + let mut x = Some(42_u8); + let _ = x.and(g()); +} + +fn test_result_and() { + // assume that this is slow call + fn g() -> Result<u8, ()> { + Ok(99) + } + let mut x: Result<u8, ()> = Ok(42); + let _ = x.and(g()); +} + fn main() {} diff --git a/tests/ui/or_fun_call.rs b/tests/ui/or_fun_call.rs index dc57bd6060a..68ef244a019 100644 --- a/tests/ui/or_fun_call.rs +++ b/tests/ui/or_fun_call.rs @@ -439,4 +439,22 @@ fn test_option_get_or_insert() { //~^ or_fun_call } +fn test_option_and() { + // assume that this is slow call + fn g() -> Option<u8> { + Some(99) + } + let mut x = Some(42_u8); + let _ = x.and(g()); +} + +fn test_result_and() { + // assume that this is slow call + fn g() -> Result<u8, ()> { + Ok(99) + } + let mut x: Result<u8, ()> = Ok(42); + let _ = x.and(g()); +} + fn main() {} |
