1
Fork 0

Rollup merge of #76890 - matthiaskrgr:matches_simpl, r=lcnr

use matches!() macro for simple if let conditions
This commit is contained in:
Ralf Jung 2020-09-20 15:52:01 +02:00 committed by GitHub
commit 8405d50e12
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 33 additions and 36 deletions

View file

@ -1931,7 +1931,7 @@ pub enum TyKind {
impl TyKind {
pub fn is_implicit_self(&self) -> bool {
if let TyKind::ImplicitSelf = *self { true } else { false }
matches!(self, TyKind::ImplicitSelf)
}
pub fn is_unit(&self) -> bool {
@ -2227,7 +2227,7 @@ pub enum Async {
impl Async {
pub fn is_async(self) -> bool {
if let Async::Yes { .. } = self { true } else { false }
matches!(self, Async::Yes { .. })
}
/// In this case this is an `async` return, the `NodeId` for the generated `impl Trait` item.
@ -2508,7 +2508,7 @@ pub enum VisibilityKind {
impl VisibilityKind {
pub fn is_pub(&self) -> bool {
if let VisibilityKind::Public = *self { true } else { false }
matches!(self, VisibilityKind::Public)
}
}