diff options
| author | Maybe Waffle <waffle.lapkin@gmail.com> | 2022-11-22 18:35:58 +0000 |
|---|---|---|
| committer | Maybe Waffle <waffle.lapkin@gmail.com> | 2022-11-27 07:19:30 +0000 |
| commit | fa89f533524ba41589b211845f19a75811330efc (patch) | |
| tree | e0c9c98f97b8cf5795eb834fe741aaa60d441820 | |
| parent | 4b6e1d1c5fc9eaedc119759d99b6105b4f7f5d1e (diff) | |
| download | rust-fa89f533524ba41589b211845f19a75811330efc.tar.gz rust-fa89f533524ba41589b211845f19a75811330efc.zip | |
Simplify `ty::ClosureKind::extends`
This is valid per the comment of the `ClosureKind` defition
| -rw-r--r-- | compiler/rustc_middle/src/ty/closure.rs | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/compiler/rustc_middle/src/ty/closure.rs b/compiler/rustc_middle/src/ty/closure.rs index 2653c8576de..e0bd4909810 100644 --- a/compiler/rustc_middle/src/ty/closure.rs +++ b/compiler/rustc_middle/src/ty/closure.rs @@ -97,15 +97,7 @@ impl<'tcx> ClosureKind { /// Returns `true` if a type that impls this closure kind /// must also implement `other`. pub fn extends(self, other: ty::ClosureKind) -> bool { - matches!( - (self, other), - (ClosureKind::Fn, ClosureKind::Fn) - | (ClosureKind::Fn, ClosureKind::FnMut) - | (ClosureKind::Fn, ClosureKind::FnOnce) - | (ClosureKind::FnMut, ClosureKind::FnMut) - | (ClosureKind::FnMut, ClosureKind::FnOnce) - | (ClosureKind::FnOnce, ClosureKind::FnOnce) - ) + self <= other } /// Returns the representative scalar type for this closure kind. |
