use matches!() macro for simple if let conditions

This commit is contained in:
Matthias Krüger 2020-09-18 19:11:06 +02:00
parent 2c69266c06
commit 40dddd3305
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)
}
}