Simplify ty::ClosureKind::extends
This is valid per the comment of the `ClosureKind` defition
This commit is contained in:
parent
4b6e1d1c5f
commit
fa89f53352
1 changed files with 1 additions and 9 deletions
|
@ -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.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue