Simplify ty::ClosureKind::extends
This is valid per the comment of the `ClosureKind` defition
This commit is contained in:
parent
4b6e1d1c5f
commit
fa89f53352
@ -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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user