Skip to content

Commit fa89f53

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

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
@@ -97,15 +97,7 @@ impl<'tcx> ClosureKind {
9797
/// Returns `true` if a type that impls this closure kind
9898
/// must also implement `other`.
9999
pub fn extends(self, other: ty::ClosureKind) -> bool {
100-
matches!(
101-
(self, other),
102-
(ClosureKind::Fn, ClosureKind::Fn)
103-
| (ClosureKind::Fn, ClosureKind::FnMut)
104-
| (ClosureKind::Fn, ClosureKind::FnOnce)
105-
| (ClosureKind::FnMut, ClosureKind::FnMut)
106-
| (ClosureKind::FnMut, ClosureKind::FnOnce)
107-
| (ClosureKind::FnOnce, ClosureKind::FnOnce)
108-
)
100+
self <= other
109101
}
110102

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

0 commit comments

Comments
 (0)