Simplify ty::ClosureKind::extends
This is valid per the comment of the `ClosureKind` defition
This commit is contained in:
@@ -97,15 +97,7 @@ impl<'tcx> ClosureKind {
|
|||||||
/// Returns `true` if a type that impls this closure kind
|
/// Returns `true` if a type that impls this closure kind
|
||||||
/// must also implement `other`.
|
/// must also implement `other`.
|
||||||
pub fn extends(self, other: ty::ClosureKind) -> bool {
|
pub fn extends(self, other: ty::ClosureKind) -> bool {
|
||||||
matches!(
|
self <= other
|
||||||
(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)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the representative scalar type for this closure kind.
|
/// Returns the representative scalar type for this closure kind.
|
||||||
|
|||||||
Reference in New Issue
Block a user