diff options
| author | J-ZhengLi <lizheng135@huawei.com> | 2022-03-29 15:23:19 +0800 |
|---|---|---|
| committer | J-ZhengLi <lizheng135@huawei.com> | 2022-03-29 15:23:19 +0800 |
| commit | 448a26d6960d9a4902db59a57b61ed0586933dfd (patch) | |
| tree | f873e65ad1d466b0130354772eb61fbcc423499e /tests | |
| parent | 4b128624ed44223b7d0b61438b0d02fc91419e43 (diff) | |
| download | rust-448a26d6960d9a4902db59a57b61ed0586933dfd.tar.gz rust-448a26d6960d9a4902db59a57b61ed0586933dfd.zip | |
improve parent expr check
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/needless_match.fixed | 12 | ||||
| -rw-r--r-- | tests/ui/needless_match.rs | 12 |
2 files changed, 24 insertions, 0 deletions
diff --git a/tests/ui/needless_match.fixed b/tests/ui/needless_match.fixed index d55dd589a54..9ccccaa1725 100644 --- a/tests/ui/needless_match.fixed +++ b/tests/ui/needless_match.fixed @@ -182,4 +182,16 @@ mod issue8551 { } } +trait Tr { + fn as_mut(&mut self) -> Result<&mut i32, &mut i32>; +} +impl Tr for Result<i32, i32> { + fn as_mut(&mut self) -> Result<&mut i32, &mut i32> { + match self { + Ok(x) => Ok(x), + Err(e) => Err(e), + } + } +} + fn main() {} diff --git a/tests/ui/needless_match.rs b/tests/ui/needless_match.rs index f3c7ee01a47..d210ecff7f1 100644 --- a/tests/ui/needless_match.rs +++ b/tests/ui/needless_match.rs @@ -219,4 +219,16 @@ mod issue8551 { } } +trait Tr { + fn as_mut(&mut self) -> Result<&mut i32, &mut i32>; +} +impl Tr for Result<i32, i32> { + fn as_mut(&mut self) -> Result<&mut i32, &mut i32> { + match self { + Ok(x) => Ok(x), + Err(e) => Err(e), + } + } +} + fn main() {} |
