Skip to content

Commit e9f6db5

Browse files
committed
Simplify ty::ClosureKind::extends
This is valid per the comment of the `ClosureKind` defition
1 parent d6f73c1 commit e9f6db5

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

compiler/rustc_middle/src/ty/closure.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,7 @@ impl<'tcx> ClosureKind {
9696
/// Returns `true` if a type that impls this closure kind
9797
/// must also implement `other`.
9898
pub fn extends(self, other: ty::ClosureKind) -> bool {
99-
matches!(
100-
(self, other),
101-
(ClosureKind::Fn, ClosureKind::Fn)
102-
| (ClosureKind::Fn, ClosureKind::FnMut)
103-
| (ClosureKind::Fn, ClosureKind::FnOnce)
104-
| (ClosureKind::FnMut, ClosureKind::FnMut)
105-
| (ClosureKind::FnMut, ClosureKind::FnOnce)
106-
| (ClosureKind::FnOnce, ClosureKind::FnOnce)
107-
)
99+
self <= other
108100
}
109101

110102
/// Returns the representative scalar type for this closure kind.

0 commit comments

Comments
 (0)