about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTomasz Miąsko <tomasz.miasko@gmail.com>2021-06-02 00:00:00 +0000
committerTomasz Miąsko <tomasz.miasko@gmail.com>2021-06-02 17:09:13 +0200
commit012c32346748f7781ff2143e9f4e53d64f2527d2 (patch)
tree30aa89c3623279b9c66e465fa1242518b9af22ae
parent1e13a9bb33debb931d603278b7f1a706b0d11660 (diff)
downloadrust-012c32346748f7781ff2143e9f4e53d64f2527d2.tar.gz
rust-012c32346748f7781ff2143e9f4e53d64f2527d2.zip
Implement `Ty::is_enum` using `matches!`
-rw-r--r--compiler/rustc_middle/src/ty/sty.rs5
1 files changed, 1 insertions, 4 deletions
diff --git a/compiler/rustc_middle/src/ty/sty.rs b/compiler/rustc_middle/src/ty/sty.rs
index f35ecb4d3cd..1222ed7b4d6 100644
--- a/compiler/rustc_middle/src/ty/sty.rs
+++ b/compiler/rustc_middle/src/ty/sty.rs
@@ -1837,10 +1837,7 @@ impl<'tcx> TyS<'tcx> {
 
     #[inline]
     pub fn is_enum(&self) -> bool {
-        match self.kind() {
-            Adt(adt_def, _) => adt_def.is_enum(),
-            _ => false,
-        }
+        matches!(self.kind(), Adt(adt_def, _) if adt_def.is_enum())
     }
 
     #[inline]